Toilet exhaust - turn on for #2 but not for #1

I want to use Rule Machine to turn on a switch based on motion detection for a minimum amount of time. Essentially, I want the exhaust fan to come on when someone's in the toilet for a poo but not when they go in there for a pee.

I thought I could perhaps achieve this by detecting motion for a minimum period of time but I'm running into logic issues.

Currently thinking
Trigger: Motion sensor active

Wait for Condition - Motion Trigger Active - Duration 2 minutes - won't it just get stuck here waiting forever if the person just pees and then leaves in a minute. How do i escape out of this so rule machine isn't just stuck at this step?

Maybe there's a better way of doing this someone can point me to :slight_smile:

I'm sure someone will come up with a better way than what I've posted below. But I think it should work (just imagine that my Guest Nightstand switch is a Vent fan).

Ok, this probably won’t be helpful, but maybe you can find an integration with the “Tony the Toilet Buddy”



Methane sensor?

1 Like

Maybe this will give you some ideas. It's kind of what I do with my Arlo cameras. If motion gets triggered 5 times and each trigger is within 5 minutes of each other then I turn off the camera.

Same principle I think. If the sensor gets triggered so many times in a certain time period then turn on the fan for x amount of time.


VOC sensor. Tuya makes a cheap one that works ok.

I would use a cancelable delayed action ( in RM Legacy):

1 Like

Motion/rotation sensor on the toilet paper roll?


Yeah - i was thinking that right after I posted my example.


The problem with any of these “solutions” (time based, toilet seat pressure/position sensor, paper roll sensor) is that your margin of error could be roughly the ratio of female/male residents.

And if you go the methane sensor route, the margin of error would be 100% on days that I have Indian food.


Does it really matter? Turn on the fan either way and invest in a quiet fan.


Anything based on time is likely to be hit and miss IMO.

Not sure where you are in the world but in the UK we have two-stage flushing toilets that have a button for short flush (less water) and a button for long flush (more water).

Probably the only near-foolproof method would be to sense the button push for the long flush.

But ultimately, does it really matter? Just turn it on for a few minutes based on any motion. Power "savings" would probably be negligible in trying to automate it further and if the issue is noise then probably simplest to replace with a quieter fan?

1 Like

I am not sure of the availability of a flow control sensor but... a motion sensor would start the cycle/timer when somebody enters the bathroom. Then use a flow control sensor on the toilet water source that would detect the "end of the cycle" when flushed. The time between motion start and toilet flush would determine what "function" was being performed and you could turn off/on the fan (with a delay) accordingly.

Aeotec Leak Sensor (or any other) with external water probe
can detect flush if installed in a right spot.

BTW, I am using Aeotec 7 Water Leak sensor as a Rain Sensor.

Have the fan on all the time someone is in the bathroom. That way it will automatically be on longer for a poo than a wee, and the smell and/or shower steam won't build up. Even pee smells somewhat.

really appreciate all the feedback on here! :smiley:

I figured out another way, motion sensor in combination with door sensor.

I'm using the predication condition to avoid retriggering.
I put a timeout just in case someone has an extremely stinky poo and they decide to close the door after leaving (usually the door stays open when no one is using it).

Open to critiques on how to improve this but seems to be working well so far :slight_smile:

Keep in mind that since you are using a delay to turn off the exhaust that is not cancelable it is turning off in 1:00 no matter what. Even if the routine is retriggered.

Maybe consider a wait for elapsed time, or make it cancellable and add a cancel delayed actions.

Also good practice to put your last end-if on there. It bugs me to not see one , but it really doesn't matter.

1 Like