I would like to trigger a scene if the garage door sensor is tripped and the back door is tripped within 5 minutes of the garage door being tripped. Note: The garage door could be closed before the back door sensor is tripped. But as long as the garage door WAS tripped within 5 minutes of the back door opening, I’d like the scene to run.
Can anyone help me with LUUP code I’d need to add to the scene trigger?
perhaps richards PLEG is more usefull for this, allthough im not sure if it supports this structure. let us know ur findings , its interesting concept.
In PLEG … Two input triggers with names GarageDoor and BackDoor
PLEG has two variants of the Sequence expression:
AnyOrder GarageDoor, BackDoor < 5:00
SpecificOrder BackDoor; GarageDoor < 5:00
Notice the difference in separating the events: comma vs semicolon.
In the specific order case … GarageDoor must happen after BackDoor.
[hr]
Doing this in LUA … you would record the time of the scene in the LUA code for each trigger … using os.date into a trigger specific variable and return true!
At the LUA code for the scene level you would put the appropriate comparison logic.
Return true if you want the scene to run, false otherwise.
Can this also be extended with sensor a and sensor b or sensor c?
[quote=“RichardTSchaefer, post:3, topic:175951”]In PLEG … Two input triggers with names GarageDoor and BackDoor
PLEG has two variants of the Sequence expression:
AnyOrder GarageDoor, BackDoor < 5:00
SpecificOrder BackDoor; GarageDoor < 5:00
Notice the difference in separating the events: comma vs semicolon.
In the specific order case … GarageDoor must happen after BackDoor.
[hr]
Doing this in LUA … you would record the time of the scene in the LUA code for each trigger … using os.date into a trigger specific variable and return true!
At the LUA code for the scene level you would put the appropriate comparison logic.
Return true if you want the scene to run, false otherwise.[/quote]
Thanks so much! Everything works like a charm! I even added the disarming of the alarm to the string to make it less likely that the event would trigger unnecessarily. Thanks again!
Can this also be extended with sensor a and sensor b or sensor c?
You can extend the logic by boolean logic with a combination of sequence expressions:
Since you provide no parenthesis in your request I interpret as follows:
Ordered:
(SensorA; SensorB < 5:00) or (SensorA; SensorB < 5:00)
UnOrdered:
SensorA, SensorB, SensorC < 5:00
Is there anything not possible with the PLEG?
Is there anything not possible with the PLEG?
There are lots it can’t do … It does not have access to any type of built-in or user defined functions.
But compared to Vera, which only supports the logical OR of it’s input triggers (Without reverting to LUA) … it can do a lot.