Question on Hubitat YouTube Video Tutorial Rule Example: Bathroom Lights

I'm starting to look at examples of simple automations and came across the YouTube video titled "A smarter way to automate bathroom lights" and liked the idea of using a contact sensor + motion sensor to instantaneously turn lights ON/OFF.

My question is around "Wait for event: Basement bathroom motion inactive". If I implemented this rule in the powder room and take the scenario where I walk in there to quickly wash my hands, leave, and CLOSE the door behind me, wouldn't this rule leave the lights on since by the time it gets to the IF...ELSE-IF statement (motion inactive), the door would be closed? I'm sure I'm just understanding this rule incorrectly, but it seems to me that this only works if the person never closes the door behind them as they leave.

In your case, yes; you may want to leave the contact sensor out of this automation if that's not a meaningful piece of information for you. Instead of the wait and if/else, a common pattern does something like "Wait for event: motion inactive --> duration 0:05:00" and then turns the lights off, among other options.

You may also want to look into an app like Room Lighting or even Basic Rule that can create this automation for you with less room for misconfiguration like a rule leaves open.

(Editing to add that this is all to say: if you're suspecting this rule was written for cases where the door is normally left open, you are correct.)


Ah I was hoping there was a way to do this without an mmWave sensor or a wait time and still have that "instant off". Is that possible?

Questions along this line often come up when people are wanting to determine presence within a room, considering common patterns of use including the opening and closing of doors and motion detection. Your example of leaving the door open while you are in the room and then leaving is a perfect example where the same sequences of events are not always a reliable method for driving automations, as habits and patterns of behaviour can change.

Contact Sensors are definitely useful when turning lights on as someone walks into a room, opening the door first. But this can be equally be problematic if the door could already open, the use of the contact sensor in this scenario is just a nice, quick, ideal situation, but would not be the only trigger, needing some other motion or similar trigger option alongside the contact sensor.

You can eliminate the duration above and make it turn the lights off as soon as motion reports inactive. However, that will still be subject to whatever internal delay your PIR sensor has, sometimes seconds but sometimes minutes, sometimes configurable. However, I think that would get annoying during regular use of the room.

I personally wouldn't worry about this too much; if I want it instant for some reason, I can still use the switch, otherwise the tiny amount of electricity saved by a few minutes' usage will not be noticed, and it's still better than the alternative of accidently leaving the lights on indefinitely. But if you want to chase this path and you have predictable door behavior, I suppose you could do something with contact changed, but that seems tricky to get right in every case.


This is true for me... While I have delays following motion being inactive in various rooms, if I'm exiting the room and I know I'm not intending to go back in, and I am passing a switch that I can use to switch the lights off, I will often manually turn the lights off.

You guys are right. I was overcomplicating it. Not everything needs to be automated. The ON is good enough. I should just view the OFF as a "safeguard from leaving it indefinitely on".


Download the Hubitat app