Help understandning the way PLEG works... :S

I am trying to wrap my head around PLEG and use it instead of the standard Vera scenes. I am not a programmer so the whole concept of conditional statements are a bit hard to “get into”… :S

If I make a PLEG that is triggered by something (e.g. during a specific time like night) , must I also specify when the scenario should end or is the scenario ended when one of the triggers is not matched?

If the scenario is automatically ended when the conditions is not met, how often does the PLEG check this?

If I have a lamp that is switched on between 21:00-06:00, will it be turned off 06:01?

In PLEG you set inputs (like triggers / schedules / device properties), which can be used in conditions. If the conditions are met, it will fire an action - if set.

This is the basic logic. However, it can be used in various ways, and therefore I recommend you to read through,21603.0.html - download the PDF-file in the first post.


Yes, I have read the manual. My question was if the action is stopped if the conditions is no longer met? Or should I build a exit in every PLEG? I understand this is very basic but I have little experience with this kind of “programming”.

The action can be various things; In my setup they normally just do one thing - i.e. turn on light - turn off light - or whatever.
If the condition is met, the action fires once. That’s it.

It would be easier to give you an example that you can use, if you tell us what you need.

If you want a light turned on at 21 - and off at 6 - I would set up two conditions; One based on a schedule for 21 and one with 6.
When time 21 is met in the condition, set action to turn light on. When time 6 is met in condition, set action to turn light off.


OK, I think I understand. In the example given the lamp would stay turned on at 6:01 if I had not specified a off-scenario, even though the conditions were no longer met?

I will try to have the “the action fires once”-quote in mind.