Can I get some suggestions on the correct way to implement a set of “safety” rules for opening/closing the Garage door please? My code is shown below, and I can’t seem to work out the syntax/details of the IF condition marked as “What is the condition here???” How can I check that the button was pushed?
Does using the Button as a trigger cause this app to be triggered multiple times (e.g., recursively?, circularly?) ... which doesn't seem like a good idea.
Trigger: Garage Door Open/Close button 3 pushed
Actions for Garage Door Open/Close
// Pause to avoid a rapid double-push
Delay 0:00:01
// Send Warning to Dashboard
Set GarageWarnText to 'WARNING: Press again (with 2-secs) to Close or Open Door '
// Wait for the next button push within 2-seconds
Wait for event: Garage Door Open/Close button 3 pushed
--> timeout: 0:00:02
// If a button push occurs within 2 seconds then open/close the door, otherwise abort
IF (Garage Door Open/Close button 3 = Pushed [What is the condition here???]) THEN
// Activate Garage Door Switch/Relay
On: K-Z10 Garage Door Open Close SR
Delay 0:00:02
Off: K-Z10 Garage Door Open Close SR
Set GarageWarnText to 'Garage Door is ??? '
END-IF
It sounds like you are looking for the fact that the %device% variable gets set to timeout if the timeout expired. See the "Wait for events" section in the Rule 5.1 docs for a bit more:
Or, to summarize, you'll need to set a local (or hub) string variable to %device% since you can't use %device% directly in a condition. Then you can use the value of this variable in a condition, specifically by checking whether it is equal to "timeout" or not.
bertabcd1234 ... Thanks for the rapid responses ... Do You ever sleep?
I'll cogitate on your responses and report back. BTW ... I have read the RM documentation a few times. But there are still some (plenty of?) things that I am still trying to understand.