Help with Rule

Hello, I am trying to figure out the best way forward for this type of rule:
IF [Door] opens within 5 minutes of HSM disarm, THEN turn on [Kitchen Light].

I've tried to find within the conditional actions in Rule Machine, but I am not having much luck on how/where I should put the conditional actions and/or if the "within 5 minutes" type time condition is available anywhere.

I suppose you could do it in one rule but quickly off the top of my head have 2 rules.
Rule 1.
Trigger
HSM changes to disarm
Action
Set Global variable HSMdisarm (boolean) to true.
Wait 5 minutes
Set Global variable HSMdisarm (boolean) to false.

Rule 2.
Trigger
Contact sensor changes to open.
Action
IF variable HSMdisarm = true THEN Turn on light.

Should work I would have thought.

I would use something like this

Trigger:
HSM Disarm

Action:
Wait for condition => door open: timeout 5 minutes
If door open turn on light

1 Like

Something like this should work. Create a local string variable (or use a hub variable if you really want to), which I've called localStringVariable but you can call whatever you want.

Trigger: HSM status changes

Actions:

IF (HSM Status is Disarmed) THEN
  Wait for event: Door open --> timeout 0:05:00
  Set localStringVariable to %device%
  IF (localStringVariable is not "timeout") THEN
    On: Kitchen Light
  END-IF
END-IF

(This is similar to the above suggestion, except it will cancel everything if HSM gets re-armed, and it does a bit more of a complicated check reason the rule proceeded--door opened vs. timeout--that I've seen staff recommend, though in most cases I suspect either would work as well.)

2 Likes

Just shows how versatile RM is.
3 ways to achieve the same thing and I bet there are lots more!!!! :slight_smile:

Thanks, I didnt see the "Wait for Events" option.
What I now have is:
Trigger: HSM Reports Disarmed
Action:
Wait for event: Door opens > timeout: 0:5:00
On: Light

I'm hoping that will do the trick.

It will not. :slight_smile: Your light will turn on after either 5 minutes or the door opening, whichever comes first. You'll need to write it one of the ways suggested above in order to get it to come on only if the door opens within that time.

1 Like

Right, use a simple conditional. IF door open then turn on light.

The wait completes if the door is open or closed. So if the wait times out and the door is still closed you don't want the light coming on.