Project Icon

adaptive-lighting

根据日光变化智能调节的Home Assistant照明系统

Adaptive Lighting是一款Home Assistant自定义组件,可根据太阳位置自动调节灯光亮度和颜色。该系统适应全天光线变化,有助于维持自然生理节奏,改善睡眠和整体健康。它提供睡眠模式,夜间将灯光调至低亮度和暖色调。用户可通过多个开关控制系统功能,如开关、睡眠模式、亮度和颜色调节等。

hacs_badge Version

All Contributors

🌞 Adaptive Lighting: Enhance Your Home's Atmosphere with Smart, Sun-Synchronized Lighting 🌙

logo

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 🤖.

⚠️ Caution: Some lights might falsely indicate an 'on' state, which could result in lights turning on unexpectedly. Disable detect_non_ha_changes if you encounter such issues.

:books: Table of Contents

: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

Note: If you plan to strictly use the UI, the adaptive_lighting: entry must still be added to the 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 nameDescriptionDefaultType
lightsList of light entity_ids to be controlled (may be empty). 🌟[]list of entity_ids
intervalFrequency to adapt the lights, in seconds. 🔄90int > 0
transitionDuration of transition when lights change, in seconds. 🕑45float 0-6553
initial_transitionDuration of the first transition when lights turn from off to on in seconds. ⏲️1float 0-6553
min_brightnessMinimum brightness percentage. 💡1int 1-100
max_brightnessMaximum brightness percentage. 💡100int 1-100
min_color_tempWarmest color temperature in Kelvin. 🔥2000int 1000-10000
max_color_tempColdest color temperature in Kelvin. ❄️5500int 1000-10000
prefer_rgb_colorWhether to prefer RGB color adjustment over light color temperature when possible. 🌈Falsebool
sleep_brightnessBrightness percentage of lights in sleep mode. 😴1int 1-100
sleep_rgb_or_color_tempUse either "rgb_color" or "color_temp" in sleep mode. 🌙color_tempone of ['color_temp', 'rgb_color']
sleep_color_tempColor temperature in sleep mode (used when sleep_rgb_or_color_temp is color_temp) in Kelvin. 😴1000int 1000-10000
sleep_rgb_colorRGB color in sleep mode (used when sleep_rgb_or_color_temp is "rgb_color"). 🌈[255, 56, 0]RGB color
sleep_transitionDuration of transition when "sleep mode" is toggled in seconds. 😴1float 0-6553
transition_until_sleepWhen enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset. 🌙Falsebool
sunrise_timeSet a fixed time (HH:MM:SS) for sunrise. 🌅Nonestr
min_sunrise_timeSet the earliest virtual sunrise time (HH:MM:SS), allowing for later sunrises. 🌅Nonestr
max_sunrise_timeSet the latest virtual sunrise time (HH:MM:SS), allowing for earlier sunrises. 🌅Nonestr
sunrise_offsetAdjust sunrise time with a positive or negative offset in seconds. ⏰0int
sunset_timeSet a fixed time (HH:MM:SS) for sunset. 🌇Nonestr
min_sunset_timeSet the earliest virtual sunset time (HH:MM:SS), allowing for later sunsets. 🌇Nonestr
max_sunset_timeSet the latest virtual sunset time (HH:MM:SS), allowing for earlier sunsets. 🌇Nonestr
sunset_offsetAdjust sunset time with a positive or negative offset in seconds. ⏰0int
brightness_modeBrightness mode to use. Possible values are default, linear, and tanh (uses brightness_mode_time_dark and brightness_mode_time_light). 📈defaultone of ['default', 'linear', 'tanh']
brightness_mode_time_dark(Ignored if brightness_mode='default') The duration in seconds to ramp up/down the brightness before/after sunrise/sunset. 📈📉900int
brightness_mode_time_light(Ignored if brightness_mode='default') The duration in seconds to ramp up/down the brightness after/before sunrise/sunset. 📈📉.3600int
take_over_controlDisable Adaptive Lighting if another source calls light.turn_on while lights are on and being adapted. Note that this calls homeassistant.update_entity every interval! 🔒Truebool
detect_non_ha_changesDetects and halts adaptations for non-light.turn_on state changes. Needs take_over_control enabled. 🕵️ Caution: ⚠️ Some lights might falsely indicate an 'on' state, which could result in lights turning on unexpectedly. Disable this feature if you encounter such issues.Falsebool
autoreset_control_secondsAutomatically reset the manual control after a number of seconds. Set to 0 to disable. ⏲️0int 0-31536000
only_onceAdapt lights only when they are turned on (true) or keep adapting them (false). 🔄Falsebool
adapt_only_on_bare_turn_onWhen turning lights on initially. If set to true, AL adapts only if light.turn_on is invoked without specifying color or brightness. ❌🌈 This e.g., prevents adaptation when activating a scene. If false, AL adapts regardless of the presence of color or brightness in the initial service_data. Needs take_over_control enabled. 🕵️Falsebool
separate_turn_on_commandsUse separate light.turn_on calls for color and brightness, needed for some light types. 🔀Falsebool
send_split_delayDelay (ms) between separate_turn_on_commands for lights that don't support simultaneous brightness and color setting. ⏲️0int 0-10000
adapt_delayWait time (seconds) between light turn on and Adaptive Lighting applying changes. Might help to avoid flickering. ⏲️0float > 0
skip_redundant_commandsSkip sending adaptation commands whose target state already equals the light's known state. Minimizes network traffic and improves the adaptation responsivity in some situations. 📉Disable if physical light states get out of sync with HA's recorded state.Falsebool
interceptIntercept and adapt light.turn_on calls to enabling instantaneous color and brightness adaptation. 🏎️ Disable for lights that do not support light.turn_on with color and brightness.Truebool
multi_light_interceptIntercept and adapt light.turn_on calls that target multiple lights. ➗⚠️ This might result in splitting up a single light.turn_on call into multiple calls, e.g., when lights are in different switches. Requires intercept to be enabled.Truebool
include_config_in_attributesShow all options as attributes on the switch in Home Assistant when set to true. 📝Falsebool

Full example:

# Example configuration.yaml entry
adaptive_lighting:
- name: "default"
  lights: []
  prefer_rgb_color: false
  transition: 45
  initial_transition: 1
  interval: 90
  min_brightness: 1
  max_brightness: 100
  min_color_temp: 2000
  max_color_temp: 5500
  sleep_brightness: 1
  sleep_color_temp: 1000
  sunrise_time: "08:00:00"  # override the sunrise time
  sunrise_offset:
  sunset_time:
  sunset_offset: 1800  # in seconds or '00:30:00'
  take_over_control: true
  detect_non_ha_changes: false
  only_once: false

:hammer_and_wrench: Services

adaptive_lighting.apply

adaptive_lighting.apply applies Adaptive Lighting settings to lights on demand.

Service data attributeDescriptionRequiredType
entity_idThe entity_id of the switch with the settings to apply. 📝list of entity_ids
lightsA light (or list of lights) to apply the settings to. 💡list of entity_ids
transitionDuration of transition when lights change, in seconds. 🕑float 0-6553
adapt_brightnessWhether to adapt the brightness of the light. 🌞bool
adapt_colorWhether to adapt the color on supporting lights. 🌈bool
prefer_rgb_colorWhether to prefer RGB color adjustment over light color temperature when possible. 🌈bool
turn_on_lightsWhether to
项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号