🌞 Adaptive Lighting: Enhance Your Home's Atmosphere with Smart, Sun-Synchronized Lighting 🌙
Adaptive Lighting is a custom component for Home Assistant that intelligently adjusts the brightness and color of your lights 💡 based on the sun's position, while still allowing for manual control.
Download and install directly through HACS (Home Assistant Community Store):
By automatically adapting the settings of your lights throughout the day, Adaptive Lighting helps maintain your natural circadian rhythm 😴, which can lead to improved sleep, mood, and overall well-being. Experience cooler color temperatures at noon, gradually transitioning to warmer colors at sunset and sunrise.
In addition to its regular mode, Adaptive Lighting also offers a "sleep mode" 🌜 which sets your lights to minimal brightness and a very warm color, perfect for winding down at night.
🌈 Visualize Adaptive Lighting's settings with the 🌞 Adaptive Lighting Simulator WebApp 🌛
https://github.com/basnijholt/adaptive-lighting/assets/6897215/68908f7d-fbf1-4991-98ce-3f2af6df996f
[ToC]
:bulb: Features
When initially turning on a light that is controlled by Adaptive Lighting, the light.turn_on service call is intercepted, and the light's brightness and color are automatically adjusted based on the sun's position.
After that, the light's brightness and color are automatically adjusted at a regular interval.
Adaptive Lighting provides four switches (using "living_room" as an example component name):
switch.adaptive_lighting_living_room: Turn Adaptive Lighting on or off and view current light settings through its attributes.switch.adaptive_lighting_sleep_mode_living_room: Activate "sleep mode" 😴 and set custom sleep_brightness and sleep_color_temp.switch.adaptive_lighting_adapt_brightness_living_room: Enable or disable brightness adaptation 🔆 for supported lights.switch.adaptive_lighting_adapt_color_living_room: Enable or disable color adaptation 🌈 for supported lights.
:control_knobs: Regain Manual Control
Adaptive Lighting is designed to automatically detect when you or another source (e.g., automation) manually changes light settings 🕹️.
When this occurs, the affected light is marked as "manually controlled," and Adaptive Lighting will not make further adjustments until the light is turned off and back on or reset using the adaptive_lighting.set_manual_control service call.
This feature is available when take_over_control is enabled.
Additionally, enabling detect_non_ha_changes allows Adaptive Lighting to detect all state changes, including those made outside of Home Assistant, by comparing the light's state to its previously used settings.
The adaptive_lighting.manual_control event is fired when a light is marked as "manually controlled," allowing for integration with automations 🤖.
With expand_light_groups: false, manual control belongs to the group. A direct member change cannot pause adaptation for only that member; use group-level manual control or enable expansion for individual tracking.
Explicit member targets in Adaptive Lighting services stay individual targets and do not mark or command the whole group.
Changing expansion at runtime discards tracking and pending adaptation for targets no longer used by any profile.
The Adaptive Lighting switch exposes these read-only attributes for its lights:
manual_control: lights with any attribute marked as manually controlled.manual_control_brightness: lights with brightness marked as manually controlled.manual_control_color: lights with color marked as manually controlled.
These lists report manual-control flags. Actual adaptation also depends on take_over_control_mode and the brightness/color adaptation switches. For example, under the default pause_all mode, manually changing only brightness leaves manual_control_color empty while pausing both brightness and color adaptation. Under pause_changed, color can continue adapting.
The attributes are absent when the Adaptive Lighting switch is off. Use a fallback when checking them in templates:
{{ 'light.bedroom' in (state_attr('switch.adaptive_lighting_bedroom', 'manual_control_brightness') or []) }}
⚠️ Caution: Some lights might falsely indicate an 'on' state, which could result in lights turning on unexpectedly. Disable
detect_non_ha_changesif you encounter such issues.
:books: Table of Contents
- :gear: Configuration
- :robot: Automation examples
- Additional Information
- :sos: Troubleshooting
- :bar_chart: Graphs!
- :eyes: See also
- :busts_in_silhouette: Contributors
- Translating Adaptive Lighting
:gear: Configuration
Adaptive Lighting supports configuration through both YAML and the frontend (Settings -> Devices and Services -> Adaptive Lighting, Adaptive Lighting -> Options), with identical option names in both methods.
# Example configuration.yaml entry
adaptive_lighting:
lights:
- light.living_room_lights
If you configure Adaptive Lighting through the UI, no adaptive_lighting: entry is needed in configuration.yaml. Instances configured through YAML must be edited in YAML.
Transform your home's atmosphere with Adaptive Lighting 🏠, and experience the benefits of intelligent, sun-synchronized lighting today!
:memo: Options
All of the configuration options are listed below, along with their default values. The YAML and frontend configuration methods support all of the options listed below.
| Variable name | Description | Default | Type |
|---|---|---|---|
lights |
List of light entity_ids to be controlled (may be empty). 🌟 | [] |
list of entity_ids |
interval |
Frequency to adapt the lights, in seconds. 🔄 | 90 |
int > 0 |
transition |
Duration of transition when lights change, in seconds. 🕑 | 45 |
float 0-6553 |
initial_transition |
Duration of the first transition when lights turn from off to on in seconds. ⏲️ |
1 |
float 0-6553 |
min_brightness |
Minimum brightness percentage. 💡 | 1 |
int 1-100 |
max_brightness |
Maximum brightness percentage. 💡 | 100 |
int 1-100 |
min_color_temp |
Warmest color temperature in Kelvin. 🔥 | 2000 |
int 1000-10000 |
max_color_temp |
Coldest color temperature in Kelvin. ❄️ | 5500 |
int 1000-10000 |
prefer_rgb_color |
Whether to prefer RGB color adjustment over light color temperature when possible. 🌈 | False |
bool |
sleep_brightness |
Brightness percentage of lights in sleep mode. 😴 | 1 |
int 1-100 |
sleep_rgb_or_color_temp |
Use either "rgb_color" or "color_temp" in sleep mode. 🌙 |
color_temp |
one of ['color_temp', 'rgb_color'] |
sleep_color_temp |
Color temperature in sleep mode (used when sleep_rgb_or_color_temp is color_temp) in Kelvin. 😴 |
1000 |
int 1000-10000 |
sleep_rgb_color |
RGB color in sleep mode (used when sleep_rgb_or_color_temp is "rgb_color"). 🌈 |
[255, 56, 0] |
RGB color |
sleep_transition |
Duration of transition when "sleep mode" is toggled in seconds. 😴 | 1 |
float 0-6553 |
transition_until_sleep |
When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset. 🌙 | False |
bool |
sunrise_time |
Set a fixed time (HH:MM:SS) for sunrise. 🌅 | None |
str |
min_sunrise_time |
Set the earliest virtual sunrise time (HH:MM:SS), allowing for later sunrises. 🌅 | None |
str |
max_sunrise_time |
Set the latest virtual sunrise time (HH:MM:SS), allowing for earlier sunrises. 🌅 | None |
str |
sunrise_offset |
Adjust sunrise time with a positive or negative offset in seconds. ⏰ | 0 |
int |
sunset_time |
Set a fixed time (HH:MM:SS) for sunset. 🌇 | None |
str |
min_sunset_time |
Set the earliest virtual sunset time (HH:MM:SS), allowing for later sunsets. 🌇 | None |
str |
max_sunset_time |
Set the latest virtual sunset time (HH:MM:SS), allowing for earlier sunsets. 🌇 | None |
str |
| `sunset_of |