You only need lights when it is dark and there somebody in the room to use it. Both conditions are easy to automate. With the price of motion sensors and smart lights, there are no reasons we need to use the switches anymore.
This routine is part of the Automation Bank, a community-driven list of over 50 practical automation ideas for your smart home. Read more about Automation Bank or search ideas by room, by device or by use case. Also, have a look at best home automation ideas as voted by our users.
We believe that light automation is one of the first things you need to do for your house and below is the guide on how to do that.
How Does It Work?
- There are two ways you can smarten your lights.
- Install a smart switch. The benefit of this is that you will save on the bulb costs and nobody will accidentally switch off the dumb lights. Cons is that you cannot control the color/brightness and so on. You also need a neutral line in the box with your switch.
- Install a smart bulb. The cons are that it is usually more expensive and somebody can switch off the smart lights using a dumb switch.
- Another important element is the motion sensor.
- Make sure that you install it in the right spot to cover the whole of the room and also avoid false triggers
- Make sure that your motion sensor will also have a luminance sensor. It will allow you to also detect when it is dark enough in the room to switch on the lights. You can rely on time, but the luminance sensor is a much more reliable approach.
What Do You Need?
How to Set Up?
Section below will have step by step instructions how to set this automation routine in the most popular smart hubs like SmartThings, Home Assistant, HomeSeer and Hubitat
Please leave comments below if you have any questions, or interested in the instruction for a specific system. This will help us to better focus our effort.
Setting in this up in Home Assistant
Setting this up consist of three main parts. I am will give you a live example that I run on my smart home setup (See my Github for details).
1. Connect your switch/bulbs and motion sensor to your system
As the example, I have a night lamp in my bedroom that I use as the secondary light. I am using Yeelight which is a color bulb. I decided to pay more for color because I am also using it for notifications (time to sleep and windows downstairs are open)
Yeelight bulbs easy to integrate and they usually auto-detected by Home Assistant. In my case, I decided to hard code it in my configurations.yaml
yeelight: devices: 192.168.1.17: name: Bedroom
For a motion sensor I am using Aeon 6 in 1 (Price not available). As with all Z-wave devices, it does not require any config changes.
2. Create automation rule to switch on Lights.
Automation rule is simple – if there is a motion and it is dark, switch on the bulb.
- id: kitchen_lights_on alias: kitchen lights on trigger: - platform: state entity_id: binary_sensor.aeon_labs_zw100_multisensor_6_sensor from: 'off' to: 'on' - platform: numeric_state entity_id: sensor.aeon_labs_zw100_multisensor_6_luminance below: '12' for: hours: 0 minutes: 5 seconds: 0 condition: condition: and conditions: - condition: state entity_id: binary_sensor.aeon_labs_zw100_multisensor_6_sensor state: 'on' - condition: numeric_state entity_id: sensor.aeon_labs_zw100_multisensor_6_luminance below: '10' action: - service: switch.turn_on entity_id: switch.kitchen_lights
Use Multiple Triggers
Note that I am using multiple triggers. This is to cover situations when you are cooking in the kitchen for a long time. In those situations, the motion sensor will be always on, but once it gets dark you would want your lights on.
3. AUtomation rule to switch off lights
This step is equally important. You need to set up automation to switch off lights as well as switch them on.
- id: kitchen_lights_off alias: kitchen lights off at night trigger: - platform: state entity_id: binary_sensor.aeon_labs_zw100_multisensor_6_sensor from: 'on' to: 'off' for: hours: 0 minutes: 10 seconds: 0 - platform: numeric_state entity_id: sensor.aeon_labs_zw100_multisensor_6_luminance above: '12' for: hours: 0 minutes: 10 seconds: 0 condition: condition: state entity_id: switch.kitchen_lights state: 'on' action: - service: switch.turn_off entity_id: switch.kitchen_lights
Using wait_template
There is a more elegant solution using wait_template. It basically would allow to combine both on and off automations in the single automation. I want to make sure that my condition “there is no motion for 10 minutes” can be implemented as well, but most likely to switch to wait_template soon. See more details here
4. Test and enjoy
Last update on 2024-10-15 / Affiliate links / Images from Amazon Product Advertising API