Home Assistant Community

Best occupancy sensor for bathroom


So I use home assistant along with multiple Philips Hue motion sensors to control my bathroom lights.
It’s currently setup to turn on when it detects motion and turn off 10 minutes after.

My problem is that for some things e.g. taking a long bath 10 minutes are not enough and you have to basically wave to get the lights on again.

Is there a better way to do occupancy sensor other than motion sensors?

I also need something battery operated.


If the bathroom door is normally kept open when unoccupied then a door sensor might be a simple way to solve your question.

Another possibility although probably not battery operated is to have a motion sensor outside the bathroom. You could then use an automation to check the time it triggered versus the time the motion sensor in the bathroom triggered.

1 Like

Both would work very well if I was the only one in the house. Unfortunately that’s not the case :frowning: .


I use simple Lutron Maestro motion-sensing switches. The motion detection is really good, and the range is better than any Z-Wave motion sensor I’ve used. The only downside is that the sensor is built into the switch, so the placement of the light switch may limit the range. It will also only replace one set of lights (of whatever light switch you are replacing). But you will be surprised at how far and wide it can detect. I use these switches in the master and guest bathrooms with no problems, even in the shower.

I’m pretty sure it can detect you in the bath, as long as you are not completely still in there. You can always buy and return them at your local home depot store if you’re not satisfied.


Xiaomi Water Sensor in the bath tub :smiley:
Weight sensor under the bath
Humidity Sensor might be able to detect steam from a bathtub.


I agree with the PIR on the outside suggestion.

Assuming you can monitor passing into and out of the area, I recommend to use a “wasp in the box” set of rules.

### The Wasp In A Box Algorithm

  1. Assume there is no wasp in the box.
  2. Have you heard the wasp buzzing in the box?
    YES = There is a wasp in the box until you are told otherwise.
  3. Have you opened the box since you last heard buzzing?
    YES = There is no wasp in the box.
    NO = There is still a wasp in the box if you heard one earlier.
  4. Got to step 2.

The PIR on the outside tests for crossing into or out of “the box”

If movement detected inside the bathroom, assume it is occupied until the PIR outside the bathroom is triggered - then you are in a state of “not sure if the bathroom is occupied” - start timing 10 minutes.

If movement detected inside again - you know bathroom is occupied - turn off timers.

Suggest you set the “bathroom occupied” logic in a binary sensor - then you can have multiple rules to set the state. Basically on is occupied, off is unknown.

1 Like

I use a temp sensor taped to the outside of the water pipe to the shower head (no bath tub here). It turns on the water heater and over rides the PIR bathroom light control for 30 minutes if the temp of the water pipe is 10F warmer than the bathroom temp. Works well for my situation.


I handle the initial trigger with motion like yourself and have that light on a timer. I however set conditions for this timer based on several inputs.

Firstly get yourself a humidity sensor this has been flawless at detecting shower occupancy. I set that if my humidity sensor is above 80 don’t turn off the light which has a secondary result of helping with mold growth by not turning off until below 80. I have kids so I use a noise sensor to detect when they are in the bath as the humidity may not spike in the summer months with bath times. One thing is the sound will. I have also taken it a step further with a bathroom panel with occupancy buttons for each of the family and one for guests. Then to take it to a rediculous level I now have a magic mirror with facial recognition so it really depends how nuts you want to go but be warned its a rabbit hole you’re about to go down lol. I also automate the heat based on season and temperature.


Two things…

Like others have said, a humidity sensor works great to determine bath or shower occupancy. Also, if you generally close the door while bathing or using the toilet for long periods of time, a door sensor works wonderfully. If the lights are on (because of motion) and the door is closed, don’t turn them off.

1 Like

I got around this by using different timers for different times of day. The bathroom lights stay on longer during the morning and evening, when I tend to use the bathroom for longer periods of time.


Thanks for the suggestions guys!
Regarding the setup suggestions using other motion sensors or door sensor, unfortunately those are not possible for me as the door is always closed whether the bathroom is in use or not. There is a motion sensor right outside the bathroom but there is always movement as it’s the landing.

Humidity and water sensors never entered in my mind and those seem like the best bet. I am going to look for a good one. I know about the Xiaomi ones. Are there any others that are better or recommended?

My current setup is quite a few Google Home devices and a mix of Smart Life(Tuya) and Philips Hue products.
Do I need to get yet another Hub if I buy the Xiaomi sensors?


Unfortunately, yes. I’ve tried running Xiaomi sensors through a Smartthings hub, then pushing the data over into Hass.io but that setup was too slow. (You also have to use custom device handlers, which can be a pain) The Smartthings hubs greatest advantage is that it’s got lots of market share, so often new consumer products will often support smartthings before they support other systems. It’s also a zigbee & z-wave hub, so it’s really flexible.

I eventually switched all my Xiaomi devices to a Zigbee ConBee stick to see if I could speed things up. It was much faster, but I was unhappy with the complicated setup. (To be fair - I set mine up during a bug fix, so my experience may be atypical). The Conbee stick supports loads of different zigbee devices, so you’re not locked into xiaomi only.

I finally settled on using a Xiaomi hub. I use the colored light on a the hub itself as an indicator for door/window open, so I’m getting double duty out of it. The xiaomi hub advantage is that they make contact, temp/humidity, motion, and moisture sensors, and they are all super cheap, and the pairing process is literally 'press the button on the hub 3x, then hold down the button on the sensor". Although - all the hub messages are in chinese.

1 Like

I see multiple gatways. Aqara, Mii Gatway 2 and Mi Home. Not even sure what to buy?


I’m not sure the one that supports home kit is compatible you should get this one https://www.gearbest.com/living-appliances/pp_344667.html?wid=1433363

1 Like

Think of using the door sensor in this fashion since you say the bathroom door is always closed regardless if occupied.

Run an automation on a delay using the door sensor. After the delay, compare the time of the door sensor closed last triggering to the time the motion sensor last triggered.

If someone is leaving the bathroom, the door closing time will always be after the motion sensor triggered. If someone is entering the bathroom, the motion sensor will always be newer than closing the door (assuming the person doesn’t just stand at the door motionless). The delay before performing the comparison is what makes this work.

If the door closing is after the last motion trigger, turn off the lights. If opposite, then keep the lights on.

The delay does not have to be long. It just has to be long enough to register movement again after the door closes. Ten or fifteen seconds should work.

Now for the odd times someone by chance leaves the door open when leaving the bathroom, you can run another automation comparing the landing motion sensor time to the bathroom motion sensor time.
Just make sure you include a condition that the bathroom door is open.

1 Like

you can also use zigbee2mqtt gateway for you hub. and it has the advantage of allowing you to connect other zigbee devices too. And it integrates directly to HA.


Not a hub per se, just use zigbee2mqtt


I perused the thread on that a while back. It looks like zigbee2mqtt requires a dongle that needs to be flashed to act as a zigbee receiver? Can zigbee2mqtt on a Raspberry Pi work without a zigbee receiver?


You need the dongle. But I flashed one a few months ago and it has required zero maintenance or attention since I set it all up one evening.


Got my Xiaomi Hub and it seems to be a nightmare. They have a hardware issue where the v3 hub has its ports closed and you have to open and solder stuff to get it working. I am really thinking about just getting a conbee stick. Is there any difference in speed between the xiaomi hub and the conbee stick?