My goal is to have a red LED flash on my Thermostats (Radio CT50e) when a portal is open. This way when we shut the lights off and go to bed there is a easy indicator if a portal is still open. For the beginning I kept it simple:
Inputs
tFrontGarageDoorOpen: Tilt Sensor on front garage door is tripped
tRearGarageDoorOpen: Tilt Sensor on rear garage door is tripped
Conditions
cPortalsOpen: tFrontGarageDoorOpen OR tRearGarageDoorOpen
cPortalsClosed: !cPortalsOpen AND (cPortalsOpen; !cPortalsOpen)
This way the LED will flash red on both thermostats when either the front or rear garage doors are open. The LED will turn off when all portals are closed and it checks to make sure a portal was open before they became closed (so that it does not constantly fire a LED off action).
I tested and it worked as planned. Questions:
Is this the “best” way?
Should I somehow use device status to turn off instead of a false condition? Any reason why this would be better?
I don’t consider myself a PLEG expert, but here are my 2 cents:
I am not sure why you added the “(cPortalsOpen; !cPortalsOpen)” to the cPortalsClosed condition.
Unless you check “Repeat” on, any condition is fired only at the first time it turns true.
Any subsequent "true"s will not make the condition fire (unless it became “false” before).
In other words:
Except for the “first time”, the condition “(cPortalsOpen; !cPortalsOpen)” will always be true whenever the condition “!cPortalsOpen” is true.
[quote=“cafri, post:4, topic:187871”]Unless you check “Repeat” on, any condition is fired only at the first time it turns true.
Any subsequent "true"s will not make the condition fire (unless it became “false” before).
In other words:
Except for the “first time”, the condition “(cPortalsOpen; !cPortalsOpen)” will always be true whenever the condition “!cPortalsOpen” is truen.[/quote]
Ok, thanks. That was what I was unsure of. I didn’t want repeat commands to turn off the LED because it keeps evaluating the condition to be true.