Program Logic Event Generator Plugin

In PLEG there is an Input Triggers Tab.

Create two triggers:
GarageClosed - Garage Door Sensor indicates Garage Door is closed
GarageOpened - Garage Door Sensor indicates Garage Door is open

You can create a Scene with a trigger where PLEG has satisfied GarageLeftOpen
There you can add your Prowl notification.

OR you can goto the PLEG Notifications tab.
And add a notification for when PLEG has satisfied GarageLeftOpen
You will need the Vera Alerts Plugin to forward this to your prowl notifier plugin.

[quote=“RichardTSchaefer, post:21, topic:173496”]In PLEG there is an Input Triggers Tab.

Create two triggers:
GarageClosed - Garage Door Sensor indicates Garage Door is closed
GarageOpened - Garage Door Sensor indicates Garage Door is open

You can create a Scene with a trigger where PLEG has satisfied GarageLeftOpen
There you can add your Prowl notification.

OR you can goto the PLEG Notifications tab.
And add a notification for when PLEG has satisfied GarageLeftOpen
You will need the Vera Alerts Plugin to forward this to your prowl notifier plugin.[/quote]

thanks for your help

one trigger for a door tripped and one for a door not tripped ?

i must be select a interval time ? the properties ?

thanks

one trigger for a door tripped and one for a door not tripped ?
YES ... You want to measure the time between these two events.
must be select a interval time ? the properties ?

You still need the condition expression:
GarageLeftOpen = GarageClosed;GarageOpened;NOW > 30:00

The condition GarageLeftOpen will be triggered 30 Minutes past the time the Garage Door was opened as long as there is not a GarageDoorClosed event. In that case the ordering of GarageClosed then GarageOpened would fail. There are other ways to code this … that’s the nice thing about programming … there is not just one way to do it right … but there are a lot of ways to do it wrong.

Then use the PLEG has satisfied condition GarageLeftOpen in the PLEG notifications tab or create a scene and use it as a trigger and put whatever action you desire in the scene.

i have 2 door
Create a second PLEG to do the second door and bind to different sensors ... or use the same PLEG and have 4 triggers and 2 conditions. Put a [b]1[/b] or [b]2[/b] suffix on the names of the triggers and conditons.

i don’t understand

i have bug with sm103 and with my doorlock the condition is none sastified

thanks

Also trying to set notification for if garage left open but I can’t quite seem to get this working. I’m trying to create a notification that alerts me if my garage is ever left open for more than 3 minutes as it is a detached garage and we always want it closed. I’ve create 2 input triggers for GarageOpen and GarageClose and one condition (GarageLeftOpen = GarageClose; GarageOpen; NOW > 3:00). The problem I am having is the condition is always firing after the garage is opened (not waiting the 3 minutes before firing so I get a notification everytime the garage is opened… even if it is immediately closed). Any ideas. I’ve attached the screenshots. Thanks for any ideas

My bad!
You do not need the GarageClosed trigger.
The following will work:

GarageLeftOpen = GarageOpen and (GarageOpen; NOW > 3:00)

So far so good. Thanks for your help and the work on this… helpful plugin. Looks like it is working now. Just so I understand, can you explain the condition logic. How does it know the garage closed? The old code seemed to make sense to me since the GarageClose porition would seem to restart the sequence expression and cancel out the open trigger if before the time limit. Just trying to understand for future opportunities.

Thanks!

GarageLeftOpen = GarageOpen and (GarageOpen; NOW > 3:00)

All conditions are evaluated in the following cases:

[ul][li]A PLEG trigger is fired[/li]
[li]A PLEG Schedule is fired[/li]
[li]A PLEG Device Property is changed[/li]
[li]If you use NOW in a sequence expression it will trigger evaluation every minute[/li][/ul]

A time is attached to a trigger when it is fires (which is also when it is first evaluates to TRUE).
A time is attached to a condition when it toggles from FALSE to TRUE.
A time is attached to a Device Property every time it changes.

These times are available to be used in the Sequence and Multi Click Expressions.
NOTE: The times for the tokens in a sequence expression are looked at … not the current true/false value)

Prior to evaluation - I re-evaluate the conditions for a Trigger
[hr]
In the example at hand:
In this case if the door is closed … than when NOW is evaluated next … the GarageOpen will return FALSE.

hello

thanks for your help but it "s not functionally at home

i have installed vera lert and i have a bug in the pleg control

i 'have uninstall all and reinstall core and pleg but allways the matter

i dont understand
my vera’s firmware 1.5.532

with 1.5.408 it seems good

have you a bug with a 1.5.532 ?

i have a bug with a trigger with specified status (arm) with a scene

Show the ADVANCED Tab settings for PLEG

The device type should be:
urn:schemas-rts-services-com:device:ProgramLogicEG:1

If it’s not change and save and then reload the browser window.

RichardTSchaefer

Thank you for the explanation above. Makes sense to me now. Thanks again!

-Scott

Richard,

First, thanks for your work. It seems to be rather complete, although I’m apparently struggling with a few concepts I hoped you could clarify.

I’m looking to do something I’d consider somewhat simple, but struggling to figure out how to maintain a persistent state for evaluating an ‘away’ switch for programming a thermostat. I’ve got a virtual switch in use, and the concept is that when that switch in active, the schedules are ignored and the temperature held.

What I’ve run into is that it seems the status of the virtual switch seems to not be updated when the trigger is fired by the switch. Perhaps I’m not using it correctly, but at the moment I have a trigger set for the switch changing state which works, a schedule and a status of the away switch. When I build conditions without the status, it seems to fire triggers to my scene with no problem, but alas no magic with the away switch.

I’m not sure if you have any suggestions there, but I was curious if this can be done with a sequential condition in some way? Its not clear to me if the conditions are persistent between events, or if they evaluate from the beginning between sequential calls. What confused me was the possibility of the ‘now’ command which seemed to imply either the execution stalls waiting for now, or is maintained between calls.

Thanks for the help,
brian

Check this reply:
[url=http://forum.micasaverde.com/index.php/topic,12759.msg99169.html#msg99169]http://forum.micasaverde.com/index.php/topic,12759.msg99169.html#msg99169[/url]

You can use a Virtual Device Switch in PLEG:
PLEG
Input
Trigger
OCCUPIED = Virtual Switch ## is ON
Condition
Schedule = OCCUPIED and ( 8:00:00; NOW; 20:00:00)
Hold = Not Schedule

Then two scenes:
ScheduleThermostat where PLEG has satisfied Schedule
HoldThermostat where PLEG has satisfied Hold

Hopefully someone can help. I hate to ask what seems like a simple question but I have been struggling with this for a couple of days since I started using PLEG to do the following.
When I got to bed, I set a scene “Sleep” that does various actions in the house. I also set a couple of variables so that the state is tracked for later. One is AtHome(v2) , the other is IsSleep(v3). Setting the “Sleep” scene sets these variables to ‘1’.
The issue is that with PLEG, I create a condition that matches a specific time daily (t3) in the morning to set the thermostat, disable some sensors and turn on various Smartswitches only if : t1(v2)==1 and t2(v3)==1

Triggers t1==1
t2==1
Schedules
t3 (Days 1-7 0600)
Condition WakeUp : (t1==1 and t2==1) and t3 . I have also just did a t1==1 and t2==1 and t3

What is happening is that I can set the Variables using the Sleep Scene the first time which sets the v2/v3 variables in the container. At the specified schedule time, the WakeUp scene matching the condition fires.
However, when I later try to set the Sleep scene again later which sets the variables back to the sleep settings , the WakeUp scene fires immediately again. Even if the time has passed for quite a while in which case it should not be a match for t3 set time. Even if I put PLEG in to Bypass mode this keeps happening.

No matter what I have tried including re-installing the plugin and at the latest version and recreating the scenes, this keeps happening. It seems that either the condition match is first match for one or both of the variables in the triggers and not evaluating if the time is correct. Or, almost as if some flag for the time is stuck so that t3 always returns true.

Hopefully the solution is as simple as my condition statement being wrong. Any help would be much appreciated.

That’s a bug …
A schedule is always returning a “True” state.
I envisioned this to just kick a scene and not to represent the specified moment in time.
You have a valid scenario … I will fix.

I think you can work around as follows:

t1==1 and t2==1 and (t3; Now< 1:00)

p.s. Did you know you can rename your trigger and timer variables names so your logic is easier to read ?
Or are you using t1, t2, t3 names to obfuscate your logic ?

Hi Richard,
Thanks for confirmation that in this specific case, I am not going insane after about 10 frustrating hours on this. I love the PLEG capability as I previously worked around it with the Clock Plugin, Combination Switch, and the Variable Container. It was not elegant. But easier than sitting down and learning LUA.

I do know I can rename the variable and did not intend to obfuscate the logic, just that after recreating the PLEG plugin a dozen times I just went with the default names until I could confirm the logic was working. Also, figured that using the default names in the post it would not confuse the terminology.

I will try the work around shortly. Looking at the simplicity of it, I am annoyed with myself that I did not think of that a couple of days ago.

Thanks for your help!

I already fixed it … it will be in a beta next week (maybe the weekend).

Also …
You can modify the names in the appropriate input editor … it will update the condition expressions for you.

I’ m getting “Invalid Value token: WINTER” in the status at the top of the UI5 page. I’m using a virtual switch device which to set “Summer mode” in the house. That switch was included in the PLEG device as a trigger (Not enabled = Winter).

Triggers:
1st_LightsOff → Combination Device that contains all of the lights on the 1st floor & gets triggered if all of them are off
2nd_LightsOff → Combination Device (same description as for 1st)
Basement_LightsOff → Combination Device (see 1st & 2nd)
Winter → Virtual Switch device – (“Summer Mode”) is turned off.
1st_LigthsOn → Triggered while virtual switch (Combo device) is off
2nd_LightsOn → Same as 1st
Basement_LightsOn → Same as 1st & 2nd.

Settings:
HouseDark = 1st_LightsOff AND 2nd_LightsOff AND Basement_LightsOff
Heat1st = Winter AND 1st_LightsOn
HeatOff1st = Winter AND 1st_LightsOff

If I rotate “Winter” and “1st_LightsOff” the message claims the invalid token is “ST_LIGHTSOFF” (chopping the 1st character off?).

Also, in the log, there are still Schedules (that have been deleted in the plugin itself and doesn’t show up there)?

50	01/25/13 20:57:14.388	luup_log:175: ProgramLogicEG:175:Initialize:Restart __LEAK__ this:24576 start:2564096 to 0x17ce000 <0x2b3e7680>
50	01/25/13 20:57:14.447	luup_log:175: ProgramLogicEG:175:EvalConditions:Condition:HouseDark Trigger:nil Result:false __LEAK__ this:126976 start:2691072 to 0x17ed000 <0x2b3e7680>
50	01/25/13 20:57:14.449	luup_log:175: ProgramLogicEG:175:EvalConditions:Condition:Heat1st Trigger:nil Result:false <0x2b3e7680>
50	01/25/13 20:57:14.460	luup_log:175: ProgramLogicEG:175:EvalConditions:Condition:HeatOff1st Trigger:nil Result:false <0x2b3e7680>
50	01/25/13 20:57:14.461	luup_log:175: ProgramLogicEG:175:SaveDB:{{name ='4am', state = true, seq = 0},{name ='9am', state = true, seq = 1359122400},{name ='SundayMovieNight', state = true, seq = 0},} <0x2b3e7680>
06	01/25/13 20:57:14.461	Device_Variable::m_szValue_set device: 175 service: urn:rts-services-com:serviceId:ProgramLogicC variable: TriggerStatusMap was: {{name ='4am', state = true, seq = 0},{name ='9am', state = true, seq = 1359122400},{name ='SundayMovieNight', state = true, seq = 0},} now: {{name ='4am', state = true, seq = 0},{name ='9am', state = true, seq = 1359122400},{name ='SundayMovieNight', state = true, seq = 0},} #hooks: 0 upnp: 0 v:0xc245f8/NONE duplicate:1 <0x2b3e7680>
50	01/25/13 20:57:14.468	luup_log:175: ProgramLogicEG:175:SweepDB:4am <0x2b3e7680>
50	01/25/13 20:57:14.469	luup_log:175: ProgramLogicEG:175:SweepDB:9am <0x2b3e7680>
50	01/25/13 20:57:14.469	luup_log:175: ProgramLogicEG:175:SweepDB:SundayMovieNight <0x2b3e7680>

Variable names can not start with a number … it’s causing a parsing error. This is true in almost every programming language.

See recent post … it’s easy to change input variable names!