UPDATED: Program Logic Timer Switch Plugin

Until the file is released you will get an error about the device you have created failing start-up. This will not effect other devices on Vera. The only way to eliminate the message is to remove the device.
I have released the fix a couple of days ago … I assume the App store folks are backed up.

I am happy to say I have managed to get all the right files into the APP store at the same time.

Plugin is ready to install for user testing. (Sorry about the problems … I am still learning the developer side of the App Store process).

Yes. I am on UI5.[/quote]

No. I meant does this plugin in particular only work on UI5?

I need to make a few small changes to run on UI4 … but I do not have a place to test.
If a UI4 client is willing … I can provide some assistance to getting this to work.

I am most willing. If you need any personal contact info just PM me.

There is a driveway (coming or going) thread that someone started and i’m in the same boat, your plugin was refernced as possible solution. here is the scenario, and i’m sure with enough time and patience I could figure this out, but if you can provide the example to set this up it would much appreciated. here is the setup;

There are 2 laser sensors on the driveway, they are roughly 4 feet apart. THis is enough to BOTH be tripped by a vehicle, AND depending on which was tripped FIRST be able to determine is someone is COMING or GOING.
so Laser1 = TRIP, then LASER 2 = Trip then Car is COMING
if Laser 2 = TRIP, then LASER 1 = Trip then Car is GOING
This is in the event of a VEHICLE

If a PERSON is walked up or down the driveway the same (Which was tripped first) still applies, however There will be a Trip / Untrip on Laser 1, then Trip / Untrip on Laser 2.

I hope this makes sense, i’ll dig further on my own once I have the alarm system running smoothly, however I figured I would put this out there since there is already some discussion on it.

Thank you

Version 1.5 just accepted and available at the APP Store (UI5)
New Features:

[ul][li]Now supports dual timers. You can now emulate the behavior of the smart switch
See the website to show an example of hot to setup a Light(s) with motion sensing during the day and different timeouts for manual operation vs motion triggering.[/li]
[li]Semantics for detecting Multi-Trigger events … i.e. detecting a switch being turned on and off multiple times during a period of time.[/li]
[li]If you edit your trigger names … it updates the condition expressions for you.[/li]
[li]If you have an error in the expression syntax it displays it in the Vera status area[/li][/ul]

The core computation and trigger editor have been split out into a separate plugin called Program Logic Core to be shared with a similar plugin. You will have to install that plugin as well. Because of the refactoring you will need to create a new device for the new functionality.

I just started messing around with this – it looks great!

I think I found a trivial glitch, at least in my UI5 Vera3. The first trigger can be added with the default name of t1 no problem, but if I add a second trigger (to reset the timer if someone turns off a light for example) with the default of t2, the trigger will not add. Changing the name of the trigger makes it work flawlessly.

One question I suppose, is there a methodology to clone a timer across multiple devices somehow? I ask both for the sake of initial setup of the timers/triggers, but also for the sake of creating a single timer definition that I can apply to many lights in the house.

GREAT plugin Richard! Thanks for your hard work!

No, I do not have a copy/paste of trigger definitions.
I need to think about that one a little … I will add it to the wish list.
A problem is that you are likely going to want to edit the trigger definitions after you copy them. I cloned much of the MCV code … it has numerous problems … I fixed some … They really do not want you to edit a trigger … you often have to delete and create a new one.

You can of course copy the condition expressions.

I have duplicated the bug with trigger names … I guess I really want you to name the trigger!
I will get it fixed soon.

I think I found with either the plugin or how UI5 handles triggers for scenes (or both?). If I try to set a trigger on a scene with the type of “A state is changed with specified status” or “A device is turned on or off with specified status”, as soon as I select anything from either dropdown for “On/Off State” or “When” all three lines for criteria dissappear and are replaced by the section “Optional: Which of the following users should be notified when the event occurs?”. I’ve attached screenshots showing what is happening, and i’ve tried in IE, Chrome and Firefox all with the same results (at first I thought it was an issue with IE’s rendering).

What I am trying to do is create a trigger when the Program Logic Times Switch is turned on, and armed then trigger the scene. Any thoughts or a workaround? I’m trying to see if I can just code it in LUUP but i’m having a hard time figuring out the coding

It’s listed in the release notes … this is a MCV bug.
I have provided MCV the fix.
I can give it to you … but it changes a CORE component of MCV … use at your own risk type of support.
For now you will not be able to use the arm/disarm status. You will have to just use:

[ul][li]A device is turned on or off[/li]
[li]A state is changed.[/li][/ul]

My bad, I did see that but for some reason it didn’t click as the same thing. I’ll just work around the bug, i’m not sure if I want to patch for this issue, thanks though.

I have upgraded the Program Logic Timer Switch and the shared plugin Program Logic Core
I now have support for absolute times in the sequence expressions.
So you can write condition expressions like:

   DayEntry = 08:00:00;DoorOpen;20:00:00 
   NightEntry =    (DoorOpen;08:00:00) or (20:00:00; DoorOpen)

Also I have support for the keyword NOW for the sequence expressions.
GarageLeftOpen = GarageClosed;GarageOpened;NOW > 30:00

If you leave the garage open for greater than 30 minutes this will trigger.

In addition to triggers you can now specify and use schedule variables in your condition expressions. A UI similar to that for schedules for a scene is provided. It has smart startup logic so that if you create an interval timer at a period of 15 minutes … it WILL run on the hour and every 15 minutes, even it Vera reboots!.

I just tried to upgrade. I get “failed to retreive plug in” message on both the switch and core plug in.

[quote=“RichardTSchaefer, post:31, topic:173258”]It’s listed in the release notes … this is a MCV bug.
I have provided MCV the fix.
I can give it to you … but it changes a CORE component of MCV … use at your own risk type of support.
For now you will not be able to use the arm/disarm status. You will have to just use:

[ul][li]A device is turned on or off[/li]
[li]A state is changed.[/li][/ul][/quote]

For what it’s worth, if you put this in the luup event of your single event trigger (on/off, etc), it will prevent it from firing if the switch is in bypassed state:

local lul_armed = luup.variable_get("urn:rts-services-com:serviceId:ProgramLogicTS", "Armed", YourDeviceID)
  if (lul_armed == "0") then
	return false

If anyone is able to share some more screenshots of real world examples, I know I would appreciate it.

Let me know what you might be interested in doing … and I could put up some more example pages.


I was just thinking of some basic examples (screenshots) that highlight the functionality, as an audio and visual learner I personally learn far more from sound and ideally a picture than I do from the written word (it plagued me throughout school).

So if I see a picture of real world examples with a very brief explanation, I’m there, I’m onboard. Show me a manual or a set of written instructions I have great difficulty visualising it. (Years of therapy needed :wink: )

There are two examples on the website … and I would be able to assist to generate others.

If you think this plugin might help … but not sure best how to use it … let me know I can help.

To many years as a software architect and now I see everything as layers of abstraction … I guess I need therapy also :slight_smile:


:slight_smile: - R.T.S - therapists make enough money - so lets save our cash and buy loads more HA stuff !! :wink:

I should probably start with something simple, but to give you an idea of what I was thinking, (not sure if this is even covered but), I was wondering if your plugin could act as a sort of ‘Dynamic/Logical Multi Room Heating System’

I have 4 temperature sensors in different rooms with 4 thermostatic radiator values.
Each radiator valve has a temperature set point (which is used more as a up/down dial, due to the terrible accuracy)
Each room also has a ‘desired’ temperature set point [held somewhere, maybe in the PLTS?)

I would like the actual temperature in each room to be checked against the desired temperature and …
If the actual temperature in any room is below the desired temperature, then the radiator set point should be increased, but no more than 2 degree points above the actual room temperature.

If an increase of the set point is needed, an additional check should be made against the central heating relay to ensure that the heating is actually on, if it’s not then first it should check if the heating is flagged to be ‘on’ if so, then the relay should be switch on (if flagged as ‘off’ it should stay off.)