No touch bathroom fan and light control


#1

Here’s a piston i wrote to control my bathroom light and fan. It uses a motion sensor in the bathroom in conjunction with a door sensor on the bathroom door to make a fairly accurate educated guess as to what’s going on and respond accordingly.

The conditions are:

  • Turn on the light when someone enters the room - Between midnight and 7am turn on to 30%
  • Turn off after 1 minute when someone leaves the room (and the door remains open behind them)
  • The light will remain on for 20 minutes if the door is closed without motion (i.e. someone is in the shower and the motion sensor can’t see them)
  • The fan will turn on 3 minutes after the light, only if the door is closed
  • If the fan is on, and the door opens, then closes again within 20 seconds the lights will turn off after 90 seconds, the fan will continue for 20 minutes
  • If any motion is detected after the above bullet’s door close, the system will revert and the light will remain on
  • Before turning off the lights, the piston will flash them by dimming to 50% and back to 100% 3 times (or until motion is detected) before turning off the lights after waiting a bit so it doesn’t leave anyone in the dark without them knowing it’s going to happen.

Usage:
If you want to change the timeouts for the fan or lights, check all the places where the warnDelay and offDelay variables are set in the piston and update accordingly. Other than that, you should just be able to add your devices and have it.


No Touch Toilet (Cloakroom) Light and Occupancy Indicator using Motion & Door Contact sensors
#2

@TRDeadbeat

Nice work!

BTW… I sent you a PM on the ST forum the other day, to verify your profile name. When you get a chance can you check it and reply so I can remove that orange banner next to your name… don’t want it to turn red :joy:


#3

@Robin
Done - thanks for the heads up, i didn’t see a notification about the message.


#4

This looks great… Thanks! Going to give it a try.

This is the biggest complainant I get from my kids “Dad your smart lighting keeps going off on me when I’m in the shower”


#5

@Figman
Throw a door sensor in the mix and that problem should go away… unless someone takes a shower with the door open :slight_smile: - Let me know how it works out.

The warning flashes will also help - you could add that snippet to your current automation without a door sensor… That way, instead of outright shutting off, the lights will flash at them so they know to reach out of the shower and wave their hand around to reset the timer.

(i highly recommend the Visonic contact sensors, they’re EXCELLENT and only cost $15 - occasionally they go on sale for $10)


#6

Actually I do have a door sensor (its not Visonic but I do own a couple that I picked up when they where $10) I made two separate pistons one for the light and one for the fan. I noticed your light switch was a dimmer as mine is just a on/off GE switch, do you think it will still work correctly like that?
Here is the lighting piston:

This is for fan control. I tried using the ZooZ 4 in 1 Motion, Humidity, Illuminance and Temperature Sensor (Enhanced) humidity sensor because the kid would never turn on the fan and all my fixtures in the bathroom were rusting.:frowning: I’m thinking of adding this somewhere in your piston.


#7

@Figman
Yes, my piston should work with just a toggle switch, you’d just want to remove the Set Level command inside the first “if” statement that turns the lights on.

Adding the humidity sensor to the piston would probably not change much in terms of behavior for the fan turning on, since the fan is going to turn on 3 minutes after the light if the door is shut. You could use humidity to detect when the fan should turn off though.

Try it out and let me know how it works.


#8

I came up with following piston. It is based on ONLY the contact sensor (no motion sensor). Using Visonic as contact sensor. Works really well for me. first part for halfbath and second one for fullbath.


#9

Is this the one you are recommending?


#10

@WCmore
Yeah, that’s the one… but the price is way up at the moment. Set up an alert on slickdeals to keep an eye out, they drop down to $10 every couple of months.

At the very least, get them from MyDigitalDiscount instead of Amazon… they’re $15 over there:
https://www.mydigitaldiscount.com/visonic-mct-340-e-wireless-door-window-temperature-sensor-2.4ghz-zigbee-now-works-natively-with-samsung-smartthings-hub/


#11

Perfect. This solves the biggest complaint with the wife.:smile:


#12

thanks, useful for me!


#13

Thank you very much for posting this, I used it as the basis of my own piston to control the light and indicator light (situated outside our downstairs toilet - the lock on the door doesn’t work). Previously I’d used a combination of HE Motion & a RM rule to try and do this, with varying results. It seems to be a very difficult problem to solve, using a motion and door contact sensor, accurately indicate if a room is occupied or not.

Here’s my take on it

As I said, this is such a difficult automation to get right - just uploaded my third iteration after I thought I got it right :grinning: