PLEG Basics - An Introduction to the Program Logic Event Generator

Program Logic Event Generator (PLEG) is an amazingly powerful and flexible tool that can be used to implement almost any automation scenario on Vera. This forum has many examples of creative and ingenious PLEG applications. Once you learn to use PLEG, you will wonder how you managed without it - and why you didn’t try it sooner! ;D

PLEG Basics is intended to provide newcomers with an explanation of how PLEG works and how to use its many features. Each feature is described in detail with examples of how it may be used. The guide is in the form of a pdf document with bookmarks to help with navigation.

Edit: 24/01/2014 09:30 New version attached. Updated to include new features of PLEG V5.6
Edit: 29/01/2014 13:40 New version attached. Updated to include new features of PLEG V5.7
Edit: 12/02/2014 18:00 New version attached. Updated to include new features of PLEG V5.9
Edit: 05/03/2014 11:25 New version attached. Updated to include new features of PLEG V6.2
Edit: 29/01/2015 16:42 New version attached. Updated to include new features of PLEG V7.35

Beautiful work! This is how documentation should be done - always :wink:

Brgds,
Martin

Could not agree more with @flyveleder

Great work, very good manual, even for someone like me who has some understanding of PLEG, it is great just to be able and check things I have not used for a while.

This should be made sticky

Hey Rex, nice PDF! Thanx! I only one to make sure of one thing.

Remember that PLEG will only perform an evaluation cycle when some Trigger, Device Property or Schedule has changed and is used in one of the Condition expressions. When an evaluation cycle is triggered every minute because the special term Now has been used in a sequence expression, the information displayed by the Status report will not be updated. It is updated when an evaluation cycle is triggered by a change in a Trigger, Device Property or Schedule.

Does this means that if I have in a PLEG, say a 100 triggers. And in the conditions, I am only using 2 of those, it will only run when any of those two works?? If this is entirely true, it is a very good new, I thought that it run anytime any trigger changes regardless if it is or not in a condition.

Thanks for the feedback, guys. I appreciate it. :smiley:

Does this means that if I have in a PLEG, say a 100 triggers. And in the conditions, I am only using 2 of those, it will only run when any of those two works?? If this is entirely true, it is a very good new, I thought that it run anytime any trigger changes regardless if it is or not in a condition.
PLEG will have to perform some processing when any of its Triggers occur even if it doesn't result in some/any Conditions being evaluated.

I have to ask why you have 100 Triggers defined if you only need two of them?

I was putting an exagerated example, but let me elaborate more my escenario:

I started with one PLEG and basic stuff months ago. PLEG is so great that now I have 80 conditions that come from like 40 triggers, 5 schedules and 10 properties, all this in one single instance of PLEG. I am going to split those into two or three instances, the way I am planning to do it is explained in this post:

[url=http://forum.micasaverde.com/index.php/topic,18221.msg141083.html#msg141083]http://forum.micasaverde.com/index.php/topic,18221.msg141083.html#msg141083[/url].

The thing is that when I am done, I will have triggers in each pleg that are not used in that instance, but in the other, and viceversa. So… if the previous quote is true, then I don’t have to worry, else, I have to take time to explicitly check wich ones are not used in each instance and delete them.

Thanks!

You will want to delete them!

Thansk Richard, I will.

Rex,
First, just a big Thank You! for taking the time to put the documentation together. As someone new to HA I had been anxious to try PLEG plug ins but felt that I needed some additional understanding of what it could and would do and more so, how to “think like PLEG”. I believe I speak for many who, though they may not bother to mention it, nonetheless feel this was a welcome endeavor.

Richard,
Again, as someone new to the world of HA and to the forums here on MicasaVerde (MiOS) I want to thank you as well, it doesn’t take a long time member to see how much time and effort you spend on the various plug ins and applications as well as being so involved in the forums with helping to answer the many questions uses have, etc.

Thanks for the great write up. Makes some of the fog disappear :slight_smile:

Rex,
Just finished reading the PDF. This is great, just finished using it to do some more automation and I planning on implementing the example you have for the Simple Heater Timer. Right now, I have schedules defined using scenes and I was going to try to figure out how to enable/disable the scenes using PLEG and a virtual switch. Now I don’t need to as the that will do exactly what I want.

Thanks for your work on the documentation and Richard’s work on the PLEG PlugIn automation is becoming easier (at least for me).
Antonio

@REXBECKETT

Nice work there! I thank you for all your work making this pdf. This is a big help and a great reference tool.

Rex,

Just wanted to say great work on the documentation. Hopefully this will help people starting out with pleg and those who did not know some things were possible with pleg.

  • Garrett

I am adding my voice to the multitude saying “great work” !!! This tutorial is very well made and the examples very clear. So thank you very much for this document.

… and once again, thank you Richard for creating such a great plugin !

... and once again, thank you Richard for creating such a great plugin !
You really must admire a guy who creates a plugin that is so powerful that it takes twenty pages to describe how it works! 8)

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

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

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.

Thanks Rex,

This is really useful.

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.