Jun 072014

I’ve been using Vera and Z-wave for a number of years as my home automation solution. As I previously posted, Home Automation: Motion sensors and lights with VERA scenes (micasaverde z-wave), sometimes the Vera system requires some workarounds with smart switches or timers in order to accomplish logic tasks for scenes. This can get quickly convoluted when you have complex logic involved or multiple schedules.

For Vera you typically need to learn to write Lua code for more complex actions, however there is a plugin which makes it easy to do in a mostly point and click operation – Program Logic Event Generator (PLEG) from RTS Services. This plugin is free for use up to 30 days, and a full license is a very reasonable $5.50.


The first step is to install the PLEG plugin in your Vera system. In this case there are actually two plugins which need to be installed, the Program Logic Event Generator Plugin and the Program Logic Core Plugin. After installing the plugins, refresh your browser window. By default, PLEG will install a new device named “Program Logic Event Generator”. Edit that device to start using an instance of the plugin (multiple instances can be added for different tasks).

Program logic event generator

PLEG first allows users to set the Inputs for a system. The inputs could be a trigger, schedule, or some element of device properties (e.g. dimmer level). One of the powerful things about PLEG is that it lets you configure a window of time for a scheduled, start and stop values. This sounds simple, but this functionality is not easily available in the default Vera interface. In my example, I have two triggers, one is a schedule from 11 PM until 30 minutes before sunrise, and the other is a tripped motion sensor which has been armed. One thing to note about names – Logic used in the next step uses the names previously saved for triggers, schedules, or properties in free text (no point and click), so it helps to use descriptive names.

PLEG triggers

PLEG schedules

After inputs come Conditions. Conditions are the logic lines which need to be followed for a specific action. Each line must evaluate to true in order to fire the Condition Name (also the Action). In my example, the LightsOn action will trigger only if ArmedSensorTripped and From2300toDawn are both true. For LightsOff, the action will fire when 20 minutes has passed since the LightsOn condition was fired. My example only has two different states, but several can be used here.

PLEG conditions

After Conditions have been defined, Actions can be associated to each. The UI behavoir here takes a little getting used to – when the Edit button is selected for a Condition, the PLEG interface will go away, and will be replaced with a devices list. After selecting the device actions (in my case turning two lights on or off) select the FINISHED button at the top of the screen to go back to the plugin.

PLEG action

PLEG actions

Once finished with Actions the new plugin logic is ready to go, after saving the settings in Vera. My example is quite simple, but there are many other ways to make use of this powerful plugin. There are some good examples on the RTS page here: PLEG Usage and a message board here with some examples & troubleshooting posts: MiCasaVerde Program Logic Plugins.

Share it! Tweet about this on TwitterShare on FacebookEmail this to someoneShare on Google+Share on LinkedInPin on PinterestShare on Reddit