Install
Click on this badge to import :
Note: You can also find the blueprint code here Automatic outdoor lighting · GitHub
Main features
This blueprint is designed to turn an outdoor light automatically based on different events :
- Luminosity (ie. turn on when it’s dark)
- Motion detection (ie. turn on for x seconds)
- Person arriving in a zone (ie. arriving home, turn on for x seconds)
Each trigger is optional and will only turn the light on during night time. Triggers are ignored if the light was previously turned on manually. Finally, if the light was forgotten ON, it will turn off automatically when it’s day time again.
Please note that I created this blueprint for personal use, and choose to share it in case anyone could benefit from it. I don’t intend to add any feature request, but do not hesitate to modify it to fit your own needs.
Prerequisites
- Any light entity.
- A binary sensor indicating if it’s dark outside (see below if your actual integrations don’t provide such entity).
- A manually created “date and time” helper which will hold the automatic turn off time of the light.
Setup
The first thing to do is to create the “date and time” helper :
- Got to “Settings / Devices & Services / Helpers tab”
- Click “Create Helper” at the bottom right
- Choose “Date and/or Time” option
- Choose an unique name for your helper and select “Date and time” type, then click “Create”
Now you can create a new automation based on this Blueprint :
- Choose the light to be controlled
- You can turn on the light with a specific dimming value (if supported), leave it to 0 to simply turn on
- Choose the “date and time” helper previously created
- Choose the binary_sensor entity which will define if it’s dark outside. You may need to create this manually as a template (see below)
- Optionally choose any number of detectors which would turn on the light (binay_sensor entities)
- Define how long the light will stay on after a detection
- If you want to turn the light on when someone arrives in a zone, you need to create it in HA settings (Settings / Area and Zones / Zone tab), and enter the entity name of the zone in the blueprint (important: a valid zone is always required, even if you don’t intend to use the location based trigger. Keep the default ‘zone.home’ if unused).
- Choose any person or device_tracker which will trigger the light when entering the zone (you can use a group entity with multiple persons in it). Do not select anybody if you don’t want to use the location based trigger.
- Define how long the light will stay on after a person enters the zone
- You can choose to automatically keep the light on when it’s dark outside, enable that here
- If you enabled automatic turn on at night, you can define a time limit for weekdays and weekends, ie. the light will turn on at sunset and turn off at 22:00 (note: if sunset happens after 22:00 the light won’t turn on at all). If you want to keep the light on all the night, use something like 12:00.
- If you enabled automatic turn on at night, you can force the automation to turn the light back on after it was manually switched off
- If you enabled the above “force light on at night”, you can define after how many seconds the automation will turn the light back on after it was manually switched off
Dark outside sensor
If you don’t have any integration providing the required binary_sensor defining if it’s dark outside, you can create a template based on the sun integration, or even better on the outside luminosity if you have such a sensor.
Example using the sun integration :
- binary_sensor:
- name: "Dark outside"
state: "{{ is_state('sun.sun', 'below_horizon') }}"
Example using an outside luminosity sensor :
- binary_sensor:
- name: "Dark outside"
state: "{{ states('sensor.luminosity') | int(default=10) < 10 }}"
Changelog
2023-07-14 : Initial release
2023-12-31 : Infinite number of detectors, Selectable zone, Infinite number of persons or device_tracker for the location based trigger (this hopefully fixes the bug related to location trigger)
2024-02-04 : new attempt to fix the zone location trigger