adaptive-lighting

adaptive-lighting

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

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

Adaptive LightingHome Assistant智能照明日光同步自动调节Github开源项目

hacs_badge Version

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

All Contributors

<!-- ALL-CONTRIBUTORS-BADGE:END -->

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

<img src="https://raw.githubusercontent.com/home-assistant/brands/master/custom_integrations/adaptive_lighting/icon@2x.png" alt="logo" width="256px" height="256px" />

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

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->

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

<!-- START_CODE --> <!-- from homeassistant.components.adaptive_lighting import _docs_helpers --> <!-- print(_docs_helpers.generate_config_markdown_table()) --> <!-- END_CODE --> <!-- START_OUTPUT --> <!-- THIS CONTENT IS AUTOMATICALLY GENERATED -->
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
<!-- END_OUTPUT -->

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.

<!-- START_CODE --> <!-- from homeassistant.components.adaptive_lighting import _docs_helpers --> <!-- print(_docs_helpers.generate_apply_markdown_table()) --> <!-- END_CODE --> <!-- START_OUTPUT --> <!-- THIS CONTENT IS AUTOMATICALLY GENERATED -->
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

编辑推荐精选

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

热门AI工具AI办公办公工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

模型训练热门AI工具内容创作智能问答AI开发讯飞星火大模型多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

3FS

3FS

一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。

3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。

下拉加载更多