Shower Fan delay timer with motion


I'm new to HE and just set up most of my devices "59" and came from Vera Edge.
Still playing around with rule machine and have a few simple rules for lighting.

But this rule setup is confusing me. Shower Fan delay timer with motion.

I would like to turn on my shower fan after motion is active for more than one minute.
I have a motion sensor in my shower for the trigger.

Motion active less than 1 min.
Shower fan stays off.
Motion is active for more than 1 min.
Shower fan turns on
Motion inactive Shower fan off after 10 min

Thanks any help is appreciated.



Welcome to the Hubitat Community!

Apologies. Rule Machine 4.0 is new and while some of us have a better grip on it, I'm still finding my way. Certainly is powerful though.

I think this will do what you want. The only thing about it is, as soon as the motion sensor becomes inactive, the fan will continue its countdown to OFF after 30 min. You can put a cancel on truth change for the 30 minute delay, but that will make it reset the timer after every time time motion sensor is active again until the fan finally turns off.

I'm not sure how to make it better, but someone here will.

Thank you for your help,

I try your rule and it looks like the shower fan comes on after two minutes even after the shower motion goes inactive.

We have a walk in shower and every time we walk pasts it or step in for a second the shower fan kicks on.
I'm trying to avoid this by ignoring the motion sensor for 1 min.
But when we are showering "after the 1 Min." I would like the shower fan on and to run 15 min after we are done.

I tried removing the 10 min off delay and the shower fan never turns off.
My shower motion trigger from active to inactive is about 30 Sec.

Thanks Again,


The rule example you were provided is pretty good, but as-is it will turn the fan on 1 minute after motion became active, regardless of what does (or doesn't) happen to the motion sensor (or anything else) after. The "Cancel?" flag set on that action comes close to solving the problem, except setting that flag alone in Rule 4.0 doesn't do anything--you need a "Cancel delayed actions" somewhere (this is a bit different from previous versions of RM for reasons I can explain if you're interested in history, but it's good to keep in mind if you see examples from older versions). In your case, it sounds like you want the "Cancel delayed actions" to run somewhere in the the IF sensor inactive and fan off block. If you want it to need to wait 2 minutes without going inactive, you also might want to increase the original delay to 0:02:00, but what you want isn't clear to me since there is a gap from 1-2 minutes where no behavior is specified. You should also be warned if using a motion sensor with a relatively short "retrigger" interval that it may send inactive reports a couple times a minutes if motion stops, and not all are quite sensitive enough to constantly remain "active" even if you're in the room but not moving around much, but perhaps you've already figured out those details.

The example you copied from his also contains one crucial difference: your trigger needs to be motion sensor changed, not motion sensor active. The "Actions" section runs whenever the trigger happens. "Changed" will catch both active and inactive, but if you only run the rule on activity, your second "IF" will never run because that conditional will always evaluate to false. (Speaking of the second IF, you could save a couple lines of code by using an "ELSE IF Bathroom Exhause Fan is on" here instead of an END-IF and an entirely new IF, but the result is equivalent.)

I can see now where I made mistakes copying the rule he provided. When I get home tonight I'm going to try this again. It took me quit a bit of time fumbling through all the menus in rule machine just to get that far.
I can also see how powerful of a tool this is going to be for me once I figure out how to use it.

Thanks to all helping me.


So after working on this for a while, this is what I came up with using your suggestions.
It seems to be working the way I want it to. Just wondering if this looks good or if I need to make a few more changes.

Thanks for your Help

Made a few more changes to my Shower Fan Delay, works great now.
Using Rule Machine 4.0
Thought I would share if anyone else wanted to use it.

  • Shower fan (on) if motion detected for more than one minute
  • Motion detected less than 1 minute cancels turn (on)
  • Shower fan turns off after 10 minutes with no motion.
  • Shower fan (on) using the switch 10 minute delay turns (off)

Thank you both or pointing me in the right direction.:smiley: