Wait for (the lack of) event - RM5?

I'm trying to wrap my brain around some concepts on RM and I'm not sure if I'm going down the right path.

The goal is:

  • If the garage light (Zooz Zwitch) is off and the door is opened (Go-Control, Z-Wave opener)
  • Turn the light on
  • Wait for 5 minutes and turn it off unless,
  • Switch "button 1" is pushed, in which case the wait is over and the light will stay on until someone manually turns it off.

Bottom line, put the light on a timer until someone "signals" it the system to disregard the timer.

Playing with RM5 I could only came up the opposite of what I need:

image

What I need is: "If button is not pushed in 5 minutes".

Any suggestions?

You can exploit the behavior of the "built-in" %device% variable here. Normally, this refers to the name of the triggering device. "Wait for event" will set this variable to "timeout" if the wait ended because of the timeout rather than the actual event (or to the device name in the other case), so after your Wait you could do something like:

Set myLocalVariable to %device%
IF (myLocalVariable equals "timeout") THEN
  Off: Garage Light
END-IF

You'll need to create a local string variable in this rule (or use a hub variable if you really need to), since you can't directly access %device% in the way you'd need to without this workaround. Otherwise, it looks like that should do what you want!

6 Likes

Genius. It is working now, thanks a lot.

2 Likes

Hi, I'm just reading over this and trying to gain a bit more wisdom. Can you explain this further. I'm not quite sure I totally understand what you've explained or what the outcome is​:blush::+1:

Which part? You can create a local string variable that rule (named whatever want), or--possibly new since I wrote that post--you could use a hub variable. The %device% thing is built in to Rule Machine, and you can use that verbatim when assigning the value of a variable (or a few other places in the UI where indicated, but the above isn't one directly, hence the need to store the value in a vairbale to use it in this way like a "real" variable later).