Bathroom lights on and off based on motion and door sensor

I’m thinking about the best way to switch lights on and off in the bathroom. Switching off after X minutes of no motion means there will often be cases of lights going off when someone is sitting on the toilet or showering (unless adding another motion sensor for the shower).

My idea is to switch on whenever motion is detected, but then also have a door sensor to aid in switching lights off. That is, something like this:

  1. Switch on when motion is detected OR when door is opened if lights are off.
  2. Switch off after 1 minute of no motion, unless motion detected after door is closed (that is, someone entering the bathroom, rather than just closing from outside).
  3. If motion detected after door is closed, leave lights on until door opens again. I.e. switch lights off X seconds after door is opened again, UNLESS new motion is detected before that time period (such as if someone is opening an unlocked door, then lights should not be switched off, to let someone play with it, like children who are not locking the door).

I will most likely use SharpTools as a dashboard. But if I create riles there they will run in the cloud. Is the above possible using local automations? WebCoRE is also run in the cloud? Or does someone have better ideas for when to switch lights off?

I also realize that if motion is detected BEFORE the door is closed, the sensor may not detect motion again until after the sensor reset period (by default 60 seconds for the Aqara Motion Sensor, I think). Then the above scenario would not work…

1 Like

@westis

To turn lights on and off with movement, what works best for me is to do 2 automations.

  1. If movement detected, then turn on the light

  2. if no movement detected (or no movement for x time), then turn off light

This way you don’t stay in the dark or turn on as soon as you move a little

Yeah, but you can be in the toilet for more than X minutes without the sensor detecting motion. That’s why I thought a combination with a door sensor would be better for presence detection. I guess I could just set the no motion time to 5 minuets and if someone stays longer without motion they will just have to wave. :slight_smile:

Exactly what I do… :wave:

Motion sensor is placed on bathroom ceiling to include shower area, toilet sometimes turns off early but never the bathroom. Using single smart lighting rule rather than 2 automations and coupled with illuminance sensor but the end result is the same :+1:

you need a presence sensor , there are several ultrasound sensors available.
But now I have an issue with washing machine, when it washes, the sensor sees the motion and keeps lights on

I think these automations could be greatly simplified, and will work more reliably, if you increase this time to something like 10-15 minutes. I usually use 15 minutes of no-motion, from a single or multiple motion sensors, for all of my occupancy automations. This allows some buffer for sitting still for a bit, ducking around a blind corner, etc.

1 Like

The shorter feedback time creates illusion that home is smart and understands your intentions.
15 min delay ruins the magic.

1 Like

I had the same puzzle as you to wrap my head around initially. Here is what i did:

In plain sight of bathroom entrance and toilet area i placed a motion sensor that detects when someone enters and if someone is catching a break from the kids with some toiletyoga.

In my shower i placed a temp & humidity sensor to detect when humidity rises in case anyone is not in plain sight of the motion sensor because they a taking a shower.

In order to execute everything locally i had to use a special Hue bridge integration in order to trigger scenes in Hue.

Here is my automations to make lights work, including the bathroom:

Mode/Location settings

  1. Mode → Morning
    If 06.00 everyday, then change location to Morning.
  2. Mode → Day
    If 1 hour after sunrise, then change location to Day.
  3. Mode → Evening
    If 1 hour before sunset, then change location to Evening.
  4. Mode → Night
    If 23.00 everyday, then change location to Night.

Bathroom Light automations:

  1. Bathroom Light Morning&Evening
    If Motion Sensor active & Location == Morning,Evening, then Bathroom Light Group On (Trigger Scene Dimmed)
  2. Bathroom Light Day
    If Motion Sensor active & Location == Day, then Bathroom Light Group On (Trigger Scene Bright)
    3 … And so on with the other locations.

To turn off Bathroom:

  1. If Motion Sensor inactive for 5min & TempHumidity Sensor is == or below 75%, then Bathroom Light Group Off.

This is a terrible lot of automations to suit my needs. But i couldn’t think of a better way to accomodate the settings for what i want without using webcore and maintain local execution.

Briljant! I’ve been struggeling to get my light to work right, never thought about using the humidity sensor for presence.

1 Like