Hubitat Logo
Hubitat Logo


VIDEO: A smarter way to automate your bathroom lights

Peter Borchers
May 26, 2023
VIDEO: A smarter way to automate your bathroom lights

This week the Hub Whisperer takes on a common problem with traditional bathroom motion lighting. If you are only using a motion sensor trigger your lights to turn on and off and you'll find yourself in the dark if you sit still too long or are in the shower where the motion sensor can't detect you. But we can solve that issue easily and affordably by adding a contact sensor to the bathroom door.

With a contact sensor on the door, we can tell the hub to keep the lights on even if motion stops as long as the bathroom door is closed. Of course, this requires you to shut the door when you use the bathroom, but unless you live alone, that is generally a good policy. 

In addition to a Hubitat Elevation hub, this automation requires a motion sensor, contact sensor and a smart switch. In this automation we also have an LED strip under the vanity. Here are the products we used:

  • Kasa Wi-Fi Switch
  • Centralite Zigbee Micro Door Sensor
  • Centralie Zigbee Motion Sensor
  • Philips Hue Zigbee Shape Light LED Lightstrip

For this automation, will also have the lights turn on differently based on the hub mode. During day and evening, the lights will turn on normally, but in the middle of the night only the LED lights trip will turn on and only at a dim red so as not to blast your eyeballs. 

This automation is easiest to create using the Room Lighting app, but can also be done in Rule Machine. 

Room Lighting App Automation

Because we are doing different lighting in different modes, you'll need to set your lighting periods by mode. It should look something like this:

Building out the rule is pretty straight forward. The lights will be activated by the motion sensor. And the means to turn off are when motion stops, but you just need to add a restriction to not turn the lights off when the contact sensor is closed. Your Motion Lighting rule will look like this:

 And that's pretty much all there is to it. But for those who are into Rule Machine, we can do that, too. 

Rule Machine Automation

To build this in Rule Machine, your trigger event is Motion being detected by the bathroom motion sensor. This will trigger the automation to turn on the bathroom lights, then wait until motion stops. At that point, we will add a conditional action to turn off the light IF the bathroom door is open. ELSE IF the bathroom door is closed, the conditional action is to wait until the door opens, then turn off the light.

Because we are doing lighting by modes, we are going to create two separate Room Light rules with different Required Expressions. Required Expressions are an optional feature of Rule Machine. If you turn on required expressions, it enables you to put a restriction on a rule that will prevent it from triggering unless the Required Expression is true. In this case, the first rule will require that the Mode be in Day or Evening mode to trigger. The second rule will require that the mode be in Sleepy Time mode to trigger. The completed rules look like this:

Alternatively, this automation can be done as a single rule without Required Expressions by stacking conditional actions inside of conditional actions. If you need help understanding conditional actions, you can watch our Rule Machine series on YouTube.  Your final rule will look like this:

I hope this gives you a better understanding of how different rule building apps in Hubitat Elevation can work in their own fashion to achieve the same results. And more importantly, by using this automation in your bathroom, you'll never catch yourself waving your hand like a crazy person to trigger the motion sensor after the light turns off on you ever again. 

For a complete step-by-step breakdown of this automation, watch the video from the Hubitat Hub Whisperer. 

Comment below with your ideas for future automation blogs and Hub Whisperer videos. 

Stay Up To Date With Smart Home Tech

Subscribe to our blog to get interesting insights, perspectives and ideas for your smart home automation.

Elevate your environment

A smart home is more than controlling lights with an app It’s about devices that do what they should do

Share this article

You Might Also Like

March 21, 2023

6 Tips for Designing a Solid Z-Wave Mesh

March 21, 2023

Dos and Don'ts of Z-Wave Power Reporting

March 21, 2023

Troubleshooting Tips for your Z-Wave Mesh