Help w Rule - trouble w bathroom fan

I have been using a rule that has been problematic and could use some help in making it more consistently meet my objective.

I have a motion sensor inside of my shower area. When it detects motion I want it to turn on the bathroom fan. Then only after motion is no longer active, I would like the fan to turn off after a delay of 10 minutes.

Here is where Iā€™ve had problems:

If Iā€™m taking a shower sometime shortly after my wife has just finished her shower, the fan will turn off while Iā€™m still using the shower. It doesnā€™t matter if I wave my arms, the motion wonā€™t trigger the fan to turn back on.

How do I create a better rule for this?

I use motion zones to increase the active time to one minute and then just do the rest with a basic rule. You can use motion aggregation even if you only have one sensor. This rule handles the lights, but you could just as easy swap in a fan. I use the bathroom humidity fan app to control my fan.



If you wanted to use humidity here's a link to the app.



1 Like

That should be a fairly simple rule.

Trigger:
Motion Active

Action:
Turn on fan
Wait for condition motion inactive - duration 10 minutes
turn off fan

Perhaps post a screenshot of your rule.

1 Like

Thatā€™s basically the rule I created but it would turn off the fan mid shower if a second person was in there while the 10-minute delay was still in progress.

Thanks for the screenshots. Very helpful.

I prefer to trigger on motion because changes in humidity arenā€™t reported as often by my Zooz 4-in-1 and Iā€™d like the fan to turn on immediately.

Having the rule use a timer has been problematic. I want to use the timer, but need to figure out a way to reset the timer when motion changes state a second time from inactive to active.

It would be helpful if you posted a screen shot of your rule. The example I gave should work. Every time the motion sensor detects activity the wait should be canceled and it will start the rule again. If it is turning off the fan while there is motion either your rule has a problem, or your sensor is not seeing the motion while you are in the shower.

The rule I posted will wait until motion stays inactive for 15 minutes before turning off. Multiple active triggers just resets the timer.

Based on your needs just change the 15 minutes to whatever works for you. I'm guessing 5 minutes would be plenty.

What app is this? Doesnā€™t look Rule Machine

image

I donā€™t see where I can create a rule that waits for a motion zone to stay inactive for a certain amount of time.

Like in your example:

image

I am using Rule Machine which doesnā€™t seem to have the capability to use ā€œwhile a motion sensor stays inactive for x minutes.ā€ (Or I just canā€™t find it)

Whoa I didnā€™t even realize thereā€™s another app for creating rules, and itā€™s literally called ā€œBasic Rulesā€ lmao. I read your suggestion quite literally it seems.

Thanks for all your help guys. I am learning something new with Hubitat almost every day. I just discovered Basic Rules and was able to create the rule that I needed in literally two minutes, when I had been fiddling around for much longer than that with Rule Machine and not able to accomplish what I was looking to do.

1 Like

Glad to help

@lewis.heidrick I tried the rule in practice tonight and it didnā€™t work as expected.

The events log shows that motion was first active at 10:44. 10 minutes later the fan turned off. But there was motion in the shower up until 10:50 and I confirmed that the sensor reported it. So I would have expected the 10-minute timer would start at 10:50 and the fan would turn off at 11:00.

Anything you notice I might be doing wrong?

I set up the motion zone just like you did and my rule seems pretty straightforward to me.

In your OP you mention you only had one sensor in your bathroom, so not sure you need to create a Zone. Perhaps just use the one sensor and not the zone and see if that works.

Well, I know the rule works or the wife would have gone nuts by now. She takes long baths and it doesn't turn off on her. Try it without the motion zone and let see some screenshots of the logs. Is the motion sensor zigbee or zwave? What about the fan? Post a screenshot of the events from the app.


Iā€™ve enabled logging on the mZone and will run a test and try to capture a screenshot later today.

Thanks guys!

What is the update rate set to on the 4-1? Speeding it up a bit might help. Turn on event and actions logging in the basic rule and post the hub post log after you trigger the rule and it deactivated.


The motion triggered at 10:23. Exactly 10 minutes later the fan turned off via the Basic Rule app.

There was motion in the shower for several minutes but the rule did not reset the 10 minute timer.

I don't see any off commands coming from the app. Can you post a screenshot of the device fan at the bottom where it says what apps are affected by it?


When the app triggers the off it should look like this: