We have moved at community.getvera.com

Author Topic: PLEG Basics - An Introduction to the Program Logic Event Generator  (Read 152122 times)

Offline poordom

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +3/-2
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #15 on: January 09, 2014, 12:41:56 pm »
Good afternoon All,

I am new to this site, my name is Dom, I am in the market to revamp my Home Automation package.

I have been using an Ocelot and other related peripherals.

I am looking at the HomeSeer Zee, and the Vera Lite.

What I which to have in my new purchase,  1) the usual  ( If and Then ) condition base operation, 2 ) regular schedulling, 3 ) External hardware triggers, ie. lights sensor and temperature sensors.

It goes without saying the the GUI is always a WOW factor that is required in any Home Automation set-up, and last but not least, dependable, easy to set-up, update, upgrade and maintain.

I would like to use the X-10 protocol for the time being, and eventually gradutate to Z-Wave.

Are these objectives attainable through VERA.

Your asistance would be greatly appreciated.

Dom

Offline twostep

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +0/-0
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #16 on: January 15, 2014, 06:20:26 am »
Hi Rex,

it's a great relief finding some well constructed documentation rather than having to trawl numerous forum messages. The one area that I don't get yet is the use of the self trigger timer. Any chance you can expand the last example in the pdf by writing an explanation of what each of the instructions are doing?

twostep

Offline RexBeckett

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3891
  • Karma: +483/-12
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #17 on: January 15, 2014, 06:45:30 am »
Hi @twostep,

Thanks for the feedback. I'll try to do this in the next release. Meanwhile:

Conditions
Target       ItsNight ? 14 : (Home ? 20 : 16)

This sets the value of Target to 14 at night or, during the day, 20 when Home is on and 16 when Home is off.


TimerEnd    !Timer5M

TimerEnd will get a timestamp when Timer5M completes (stops).


SendSP    (Target != LastTarget) or (TimerEnd and (TimerEnd; Now < 1:00) and (SetPoint != Target))

Becomes true if Target has changed since last run, or Timer5M has just ended and SetPoint is still not equal to Target. In other words, it either shows that something changed Target or that, after five minutes, the thermostat didn't change to our last requested Target. It indicates that we need to send another SetCurrentSetpoint request.


LastTarget   Target

LastTarget gets updated to the current value of Target for comparison on next run.

Actions
SendSP      TRV SetCurrentSetpoint   NewCurrentSetpoint={(Target)}
                  PLEG StartTimer  timerName=Timer5M

The first one sends a SetCurrentSetpoint request to TRV using the value of Target as NewCurrentSetpoint. The second one starts the Self-Trigger timer Time5M.


Offline twostep

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +0/-0
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #18 on: January 15, 2014, 03:53:14 pm »
Thanks Rex,

This is really useful.


Offline RexBeckett

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3891
  • Karma: +483/-12
PLEG Basics - An Introduction to the Program Logic Event Generator V5.6
« Reply #19 on: January 24, 2014, 04:35:08 am »
There's an updated version of PLEG Basics that includes the new features introduced in PLEG V5.6. See the first post to download the pdf.

Offline svaleb

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +11/-7
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #20 on: January 24, 2014, 09:07:54 am »
Thanks Rex.
I am looking forward to be able to use PLEG better.
And thanks to Richard for the great work.
Regards
         CE

Offline Sender

  • Hero Member
  • *****
  • Posts: 973
  • Karma: +552/-467
  • Sr. manager of my Vera
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #21 on: January 26, 2014, 01:03:52 pm »
Hi Rex,

assume I have a motion sensor that turns a lamp on when there is motion and light level is below 35%. And after 3 minutes turns it off. This works well with my pleg:
(CurrentLevel < 35) and Motion

but now, where do I start if I want this lamp to turn off AFTER the last motion?
Good firmware is more important than good karma. (and this costed me lots of Karma)

Offline RexBeckett

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3891
  • Karma: +483/-12
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #22 on: January 26, 2014, 02:22:21 pm »
Hi Rex,

assume I have a motion sensor that turns a lamp on when there is motion and light level is below 35%. And after 3 minutes turns it off. This works well with my pleg:
(CurrentLevel < 35) and Motion

but now, where do I start if I want this lamp to turn off AFTER the last motion?
One possibility is a Condition like this:

AutoOff     LightOn and !Motion and (!Motion; Now > 3:00)

This will become true three minutes after the last motion trip cleared - if the light is on.

Offline Sender

  • Hero Member
  • *****
  • Posts: 973
  • Karma: +552/-467
  • Sr. manager of my Vera
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #23 on: January 26, 2014, 02:32:54 pm »
Thanks. And what would "AutoOff" and "LightOn" be? Triggers?
Good firmware is more important than good karma. (and this costed me lots of Karma)

Offline BrianLBeaton

  • Sr. Member
  • ****
  • Posts: 325
  • Karma: +12/-1
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #24 on: January 26, 2014, 04:10:01 pm »
Thanks. And what would "AutoOff" and "LightOn" be? Triggers?

AutoOff would be a Condition.

LightOn would be a Trigger.

Offline Sender

  • Hero Member
  • *****
  • Posts: 973
  • Karma: +552/-467
  • Sr. manager of my Vera
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #25 on: January 27, 2014, 10:51:12 am »
Rex, Brian,

sorry, my bad. I really do not know where to start...

I want: the light to only turn on when light level is below 35% and motion is detected. (this wors great with below).
Then additionally I would want to "reset" the 3 minutes timer with every new motion detection during that "running" 3 minutes.

this is it currently

Lamp Trappenhuis Light & Beweging

Device ID: 1832014-01-27 16:49:03.549 PLC Version: 5.6

Triggers

Name   Description   State   Last True   Last False
Motion    Sensor 2e Verdieping Beweging armed is tripped   false   2014-01-27 08:52:30.438   2014-01-27 08:53:22.117

Device Properties

Name   Device Name   Device Variable   Value   Last Change   Previous Change
CurrentLevel   Sensor 2e Verdieping Licht   CurrentLevel   21   2014-01-27 16:44:48.910   2014-01-27 15:44:30.245

Conditions

Name   Expression   State   Last True   Last False
c1   (CurrentLevel < 35) and Motion   false   2014-01-27 08:52:30.440   2014-01-27 08:53:22.119
Actions

Actions for Condition: c1

Immediate

Device   Action   Arguments
Lamp Trappenhuis 2e Verdieping   SetTarget    newTargetValue=1
Delay 03:00

Device   Action   Arguments
Lamp Trappenhuis 2e Verdieping   SetTarget    newTargetValue=0

What do I need to change add and where?
« Last Edit: January 27, 2014, 10:55:22 am by SanderL »
Good firmware is more important than good karma. (and this costed me lots of Karma)

Offline RichardTSchaefer

  • Moderator
  • Master Member
  • *****
  • Posts: 10091
  • Karma: +764/-143
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #26 on: January 27, 2014, 11:45:40 am »
Once you start an ACTION ... it will always complete ...  including delayed actions.

There is no way to extend this. When done in a Scene, if Vera Restarts during the actions, the delayed actions are not exectuted. In PLEG/PLTS even if Vera Reboots, the delayed actions will get executed.


An input schedule:
TImeout    A Self Restartable Timer for 3 minutes

You need you break your logic into two conditions.
TriggeredCondition       Your Logic Here
DelayedTriggerCondition     TriggeredCondition and (TiggeredCondition;!Timeout)


Actions:
TriggeredCondition    Start the Timeout Timer + any thing else you want to do every trigger
DelayedTriggerCondition    Any Actions after the timeout expires.

Offline Sender

  • Hero Member
  • *****
  • Posts: 973
  • Karma: +552/-467
  • Sr. manager of my Vera
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #27 on: January 27, 2014, 02:37:32 pm »
Richard i really appreciate your reply and info. But i still do not understand how to achieve what i want... question is still: what do i need to change/add and where?
Good firmware is more important than good karma. (and this costed me lots of Karma)

Offline RexBeckett

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3891
  • Karma: +483/-12
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #28 on: January 29, 2014, 08:45:52 am »
There's an updated version of PLEG Basics that reflects the changes in PLEG V5.7. I have also added some explanation of the recent issues people have had with Start-only Schedules. See the first post to download the pdf.

Offline hamishb

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +1/-0
Re: PLEG Basics - An Introduction to the Program Logic Event Generator
« Reply #29 on: January 29, 2014, 11:39:01 pm »
OK I have installed PLEG and tried to add a trigger for when device #4 Study Sensor is triggered.

I tried to edit the "undefined" Name and Description but do not seem to be able to change this text.

Ideas?