Does this delayed rule look ok?

I am working up a rule that will turn on an exhaust fan when motion is detected in the shower.

I wish the fan to shut off 45 minutes after the last motion is detected.

I am a little worried about stacking up delayed actions... not sure if Hubitat has an issue with that or not.

Of course I am testing but I thought I'd ask the community too if I am going about this correctly. Here is what I have so far.


If motion active
Cancel delayed actions
If fan is off Then
Turn on fan
End if
Turn off fan with delay if 45 (cancelable)
End if

The above is more or less what you want, but it's also worth asking: is there a reason you're using Rule Machine for this? Both the built-in Motion Lighting or Simple Lighting apps could handle this automation with a lot less work to set up (they work with any switch, nothing specific to lighting). If you plan on doing more and want the power of RM, I'd highly recommend reading the docs first. They contain an example almost exactly like what you're trying to do.

OK thanks for the input. I am going to try this using Rule.... but if it doesnt work... I'll go ahead and try the lighting apps. Thanks again!

Based on your statement, I would modify your rule to start the delay at the beginning of inactivity

MasterShowerMotion active

Cancel Delayed Actions
On: Master Shower Accent Lights, Master Shower Fan
Wait for events: MasterShowerMotion inactive
Off: Master Shower Accent Lights, Master Shower Fan --> delayed:  0:45:00 (cancelable)

In the above rule the trigger needs to be 'changed ' not active otherwise the inactive statement will never be evaluated.

EDIT: This is incorrect. See the posts below. Ooooops.

@bobbles that's not correct. The inactive in the "Wait for events" doesn't need to be included in the trigger. The subscription to wait for events is not dependent upon a trigger. I use this logic quite a lot. If that were true a wait for events = a certain time wouldn't work either.

1 Like

Yep. You are correct on this.
I've never used wait for events and hadn't thought it through.
It's obvious when you think about it that what you say is correct as it wouldn't work otherwise.
Thanks for pointing this out to save me confusing people even more. :smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.