Features Timer Switch Event Generator License Operation Inputs Syntax Actions Usage Known Issues Requests Other Plugins Contact Me

Program Logic Core

Provides the computation core for the Program Logic Timer Switch and the Program Logic Event Generator



When first installed you will have 30 days of unlimited access for 3 PLEG or PLTS devices (total count). After 30 days you will be allowed to use this software without a license with a max of 5 inputs and 5 conditions for these 3 devices.

The purchase of a license will provide you unlimited inputs and conditions for a total of 4 PLEG or PLTS devices (total count). The license is tied to your Vera via it's serial number. The cost for a license is $5.95 US and is a one time fee. If you need more devices you can purchase multiple licenses.

If you change or upgrade your Vera you will need a new license (remember the license is tied to your serial number). The upgrade policy is as follows. If you have N licenses ... we will provide you with N Licenses for the price of N/3 rounded up to the next whole licenses. (i.e. if you had 1 license you will need to buy 1 license. If you have 5 licenses, you will have to buy 2 licenses). After purchasing your new license(s) email us to obtain your additional licenses.

You can purchase your license from the Registration Portal, which is accessible from the Plugin Devices. You can always go back to the Registration portal if you want to obtain an additional license and/or retrieve your license key.


When are conditions Evaluated ?

The condition Expressions are evaluated whenever an input Trigger is fired, a Device Property is changed, or a Schedule On or Off has arrived. Also if the NOW clause is used then conditions are evaluated every minute.

When will true conditions cause a Trigger and or Action to fire ?

In order for a Condition to initiate an output Trigger and/or fire an Action the following must be true: Also, the PLTS, PLEG (as appropriate) must be Armed for the actions to be executed. Other scenes or plugins can trap the Condition XXX is satisfied independent of the Armed status.

Can I pass parameters to the Actions ?

Yes, using the Advanced tab of the Action Editor you can place a condition Variable, or Expression in the argument of a device action using the following syntax:


The following editors provide the user the ability to bind any of the following input types to variables that can be used in your Condition Expressions.

Condition Expression Syntax

All conditions are named. For PLTS all of the conditions are predefined. For PLEG there are two RESERVED condition names. These are ARM and BYPASS. These allow you to add logic to ARM and BYPASS respectively the current PLEG/PLTS device. A condition is satisfied when the condition expression is true. A condition expression can be any of the following:

Grouping Expressions using parentheses

( expression )
This is necessary to explicitly control the evaluation logic, otherwise evaluation is decided by the precedence of the operators.

The simplest expression ...

Just a Device Property, Schedule, or Trigger, or Condition Name

Counter Expressions

Actually this is just a simplification of the general expression described below.

TriggerOrCondition1 + TriggerOrCondition2 + ... TriggerOrConditionN > 2
TriggerOrCondition1 + TriggerOrCondition2 + ... TriggerOrConditionN < 2

Each currently active trigger or condition counts as 1.
This expression is true when the count is greater or less than, as appropriate, to the count of triggers or conditions.

Sequence Expressions

Every Trigger, Schedule, or Condition variable has a time associated with it when it was most recently transitioned from false to true. Note: If a condition is specified as Repeat then the time is set every time the condition is evaluated to true. A device property has a time when it was last changed. This time is what is used when you reference these variables in a Sequence Expressions.

A SequenceToken in a Sequence expression can be any of the following:

  1. TriggerN or !TriggerN
  2. ScheduleN or !ScheduleN
  3. ConditionN or !ConditionN
  4. Device Property
  5. Absolute Time in HH:MM:SS format
  6. NOW - A reserved word representing the current time.
    This is useful for timeouts: (DoorOpen; Now > 30:00) Trigger if DoorOpen is still valid after 30 minutes.
The ! variants use the Off Time Stamp, otherwise, the On TimeStamp is used. These can be specified to be either a time ordered, or time unordered sequences of tokens. Followed by one or both of the following time constraints
i.e. SequenceToken1; SequenceToken2 > 30 < 5:00
This expression is true when SequenceToken2 follows SequenceToken1 by more than 30 seconds but less than 5 minutes.

NOTE: This does not have support for >= or <= comparison operators.

Multiple Trigger Expressions

The syntax is:
TiggerNameOrDevicePropertyOrCondition @ Count
Followed by one or both of the following time constraints
i.e. TriggerOrDevicePropertyOrCondition1 @ 3 < 30
True if TriggerOrDevicePropertyOrCondition1 happens 3 times in less than 30 seconds

This is useful for debouncing noisy triggers. It also allows you to add semantics to how often an event happens.

General Expressions

Note that the leading number for each of the following expressions indicates the precedence of the operator. You can use parenthesis to change the precedence. If you wish to combine a Sequence and/or Multiple Trigger expression together in a General Expression they MUST be wrapped in parentheses.

In some cases data types can be coerced. A Numeric value of > 0 in a Boolean context is treated as a true. A value of 0 is treated as false. A String of length > 0 in a Boolean context is treated as true. A String of length 0 in a Boolean context is treated as a false. In a Numeric context, a true Boolean has a value of 1 and a false Boolean has a value of 0. In actuality a counted expression is just a numeric addition where the arguments are coerced to zeros or ones before adding the values.


Each Condition can have a set of actions that can be invoked when the condition is first evaluated to be true, or if the condition is marked as Repeat, then every time it is evaluated to be true.

The action editor looks like the Scene editor, although it has a few less options. It does not allow you to specify Triggers.

You can have LUA code run as part of your actions.
This has the same behavior as a SCENE Level LUA ... i.e. if it returns false, it stops executing the explicit actions. If it returns nothing or true it will run the explicit actions. The LUA has context (unlike a scene).
For each input Variable name or Condition name xxx you have access to it from LUA as

Where XXX is the uppercase of the input or condion name. And XXX.state is the value, XXX.seq is the On timestamp and XXX.oseq is the Off timestamp, and XXX.seqh is a history of the last N on timestamps (max of 10, not saved across restarts, only the most recent one is) XXX.seq should always equal XXX.seqh[1]. The seqh is currently only used internally for the Multi-Trigger checks.
The LUA context is unique for each Plugin. You can share global variables between Actions, but not between PLEG/PLTS devices or Vera Scenes.

In a scene, if it has delayed actions, and Vera restarts during the scene, the delayed actions will never happen. In PLEG/PLTS these actions will be invoked even if Vera restarts during the execution of these actions. In the advanced TAB you can add actions that are not available via the Device Panel. These actions typically require addition input, which cannot be specified on the Devices panel. The PLEG/PLTS device supports the following actions which you may find useful:

It's not uncommon to add a Notification using Vera Alerts or the PushNotification in the Advanced Tab for a particular Action to record that a condition has been satisfied.


If you have an interesting usage you would like to share it please send me a copy of the PLEG/PLTS report and a short description of what it does. I will enumerate and link them here.



Contact me at Schaefer@RTS-Services.com

© Copyright 2017, RTS Services Inc. All Rights Reserved
1675 Hickory Creek Rd
Marble Falls, Tx 78654