adaptive-lighting/custom_components/adaptive_lighting/const.py

395 lines
15 KiB
Python
Raw Normal View History

Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"""Constants for the Adaptive Lighting integration (CDiT fork)."""
2025-11-27 21:01:05 +01:00
from datetime import timedelta
from typing import Any
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
2020-09-23 18:20:25 +02:00
from homeassistant.components.light import VALID_TRANSITION
from homeassistant.const import CONF_ENTITY_ID
2020-09-23 12:35:57 +02:00
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# CDiT icons (task 2.5). Master switch signals "this is an automatic system",
# the two adapt switches name the attribute they govern.
ICON_MAIN = "mdi:weather-sunny-alert"
ICON_BRIGHTNESS = "mdi:brightness-percent"
ICON_COLOR_TEMP = "mdi:invert-colors"
2020-09-12 23:25:36 +02:00
DOMAIN = "adaptive_lighting"
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# Half-width of the tanh ramp around each sun event, in seconds.
# 30 minutes is the eye-friendly circadian-transition sweet spot; long enough
# to feel gradual, short enough to stay in-window across solstice-to-equinox
# sunrise drift. Documented in design.md decision 15.
# Since add-runtime-ramp-width this is the FALLBACK: the live value comes
# from the per-profile ramp half-width number entity (default 30 min).
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
RAMP_HALF_WIDTH_SECONDS = 1800
# Runtime ramp half-width entity (add-runtime-ramp-width R1, R2, D2, D3).
# Deliberately NOT in VALIDATION_TUPLES: there is no options-flow field —
# the number entity is the only surface, with the constant above as the
# unavailable-entity fallback. Unit is minutes; the curve consumes seconds.
CONF_RAMP_HALF_WIDTH = "ramp_half_width"
DEFAULT_RAMP_HALF_WIDTH_MIN = 30 # minutes; == RAMP_HALF_WIDTH_SECONDS / 60
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# CDiT config-entry schema version. Bumped from upstream's implicit v1.
# An entry with version < CONFIG_ENTRY_VERSION fails async_setup_entry with
# a "recreate this entry" message — see design.md decision 4.
CONFIG_ENTRY_VERSION = 2
DOCS = {CONF_ENTITY_ID: "Entity ID of the switch. 📝"}
2020-09-19 11:10:54 +02:00
CONF_NAME, DEFAULT_NAME = "name", "default"
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_NAME] = "Display name for this profile."
2020-09-15 23:33:19 +02:00
CONF_LIGHTS, DEFAULT_LIGHTS = "lights", []
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_LIGHTS] = "Light entities this profile controls."
CONF_INCLUDE_CONFIG_IN_ATTRIBUTES, DEFAULT_INCLUDE_CONFIG_IN_ATTRIBUTES = (
"include_config_in_attributes",
False,
)
DOCS[CONF_INCLUDE_CONFIG_IN_ATTRIBUTES] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Expose all configuration options as attributes on the master switch "
"for debugging."
)
2020-09-12 23:25:36 +02:00
CONF_INITIAL_TRANSITION, DEFAULT_INITIAL_TRANSITION = "initial_transition", 1
DOCS[CONF_INITIAL_TRANSITION] = "Fade time when a light first turns on, in seconds."
CONF_INTERVAL, DEFAULT_INTERVAL = "interval", 90
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_INTERVAL] = "How often to recompute and re-apply the curve, in seconds."
# CDiT default: 90 instead of upstream's 100. Leaves headroom so a manual
# "brighter please" bump above the curve is always possible.
CONF_MAX_BRIGHTNESS, DEFAULT_MAX_BRIGHTNESS = "max_brightness", 90
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_MAX_BRIGHTNESS] = "Brightness at the peak of the day, in percent."
2020-09-15 23:33:19 +02:00
CONF_MAX_COLOR_TEMP, DEFAULT_MAX_COLOR_TEMP = "max_color_temp", 5500
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_MAX_COLOR_TEMP] = "Color temperature at the peak of the day, in Kelvin."
# CDiT default: 10 instead of upstream's 1. 1% reads as off on most bulbs
# (and 5% proved too dim on gloomy days); 10% is the usable floor.
CONF_MIN_BRIGHTNESS, DEFAULT_MIN_BRIGHTNESS = "min_brightness", 10
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_MIN_BRIGHTNESS] = "Brightness during the night, in percent."
# CDiT default: 2000 K (matches upstream). Earlier the fork used 2200 K
# ("sodium-vapor orange" worry), but in practice the deeper warm tone won.
CONF_MIN_COLOR_TEMP, DEFAULT_MIN_COLOR_TEMP = "min_color_temp", 2000
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_MIN_COLOR_TEMP] = "Color temperature during the night, in Kelvin."
CONF_PREFER_RGB_COLOR, DEFAULT_PREFER_RGB_COLOR = "prefer_rgb_color", False
DOCS[CONF_PREFER_RGB_COLOR] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Prefer RGB color over color temperature when a light supports both."
)
CONF_SEPARATE_TURN_ON_COMMANDS, DEFAULT_SEPARATE_TURN_ON_COMMANDS = (
"separate_turn_on_commands",
False,
)
DOCS[CONF_SEPARATE_TURN_ON_COMMANDS] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Use separate `light.turn_on` calls for color and brightness. Required "
"by some lights that cannot accept both at once."
)
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
CONF_SUNRISE_ENTITY, DEFAULT_SUNRISE_ENTITY = (
"sunrise_entity",
"sensor.sun_next_rising",
)
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_SUNRISE_ENTITY] = (
"Sensor whose state is the next sunrise timestamp. Defaults to the "
"built-in `sensor.sun_next_rising`; point at a Sun2 sensor for civil, "
"nautical, or astronomical twilight."
)
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
CONF_SUNSET_ENTITY, DEFAULT_SUNSET_ENTITY = (
"sunset_entity",
"sensor.sun_next_setting",
)
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_SUNSET_ENTITY] = (
"Sensor whose state is the next sunset timestamp. Defaults to the "
"built-in `sensor.sun_next_setting`."
)
2020-10-05 14:41:21 +02:00
CONF_TRANSITION, DEFAULT_TRANSITION = "transition", 45
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_TRANSITION] = "Fade time for each scheduled curve update, in seconds."
CONF_ADAPT_DELAY, DEFAULT_ADAPT_DELAY = "adapt_delay", 0
DOCS[CONF_ADAPT_DELAY] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Wait time after a light turns on before applying the curve, in seconds. "
"Avoids flickering on lights that report 'on' before they have settled."
)
CONF_SEND_SPLIT_DELAY, DEFAULT_SEND_SPLIT_DELAY = "send_split_delay", 0
DOCS[CONF_SEND_SPLIT_DELAY] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Pause between the two `light.turn_on` calls when "
"`separate_turn_on_commands` is enabled, in milliseconds."
)
CONF_SKIP_REDUNDANT_COMMANDS, DEFAULT_SKIP_REDUNDANT_COMMANDS = (
"skip_redundant_commands",
False,
)
DOCS[CONF_SKIP_REDUNDANT_COMMANDS] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Don't send a command when the light is already at the target state. "
"Cuts traffic; disable if HA's recorded state drifts from the physical "
"light."
)
CONF_INTERCEPT, DEFAULT_INTERCEPT = "intercept", True
DOCS[CONF_INTERCEPT] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Intercept `light.turn_on` calls to apply the curve instantly, instead "
"of waiting for the next scheduled update."
)
CONF_LUX_SENSOR, DEFAULT_LUX_SENSOR = "lux_sensor", ""
DOCS[CONF_LUX_SENSOR] = (
"An illuminance sensor used to dim lights when ambient light exceeds the target. "
"Leave empty to use the sun curve alone."
)
CONF_TARGET_LUX, DEFAULT_TARGET_LUX = "target_lux", 0
DOCS[CONF_TARGET_LUX] = (
"Desired illuminance in lux. When the sensor reads above this value, "
"lights dim proportionally. 0 disables lux-based dimming."
)
Implement call intercept for multiple lights (#679) * Implement call intercept for multiple lights * remove comment * skip if no eids * add comment * fix type * Fix skipped * indentation * Add logging and fix error * Fix for HA ≤2023.04 * simplify * remove unused ignores * Debug mode * Add test * Make test failing * rename switch * rename lights * Fix tests * Rename lights in tests * Remove unused dependencies * Improve tests * More tests * Remove the DEBUG_MODE * Add doc-string * Extra test * assert * extra test * Comments * fix * fix * expand light groups * more logging * sort * Revert is_proactively_adapting checks This reverts commit 39fd8f2be0f3d6bef27705d167b5eab8113d5709. * simplify the mapping * Revert "Revert is_proactively_adapting checks" This reverts commit 18803e8e507c9b44934e15320c1bbed7fa30b788. * test * no light groups * do not expand * Do not expand_light_groups in intercept * more logging * Fix * add comment * Add multi_light_intercept config option * Update README.md, strings.json, and services.yaml * add light group * fix platform * add simple test * turn off again * Test without take over control * improve test and fix it in one way * Fixes * add cleanup fixture * format * Update test_switch.py * add __str__ * remove unneeded call * simplify service_data construction * Generalize is_our_context * Fix multi_light_intercept: false * add comments * add docs * Update README.md, strings.json, and services.yaml * Add feature line * move function --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 17:47:09 -07:00
CONF_MULTI_LIGHT_INTERCEPT, DEFAULT_MULTI_LIGHT_INTERCEPT = (
"multi_light_intercept",
True,
)
DOCS[CONF_MULTI_LIGHT_INTERCEPT] = (
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"Also intercept `light.turn_on` calls that target multiple lights. "
"Requires `intercept` to be enabled."
Implement call intercept for multiple lights (#679) * Implement call intercept for multiple lights * remove comment * skip if no eids * add comment * fix type * Fix skipped * indentation * Add logging and fix error * Fix for HA ≤2023.04 * simplify * remove unused ignores * Debug mode * Add test * Make test failing * rename switch * rename lights * Fix tests * Rename lights in tests * Remove unused dependencies * Improve tests * More tests * Remove the DEBUG_MODE * Add doc-string * Extra test * assert * extra test * Comments * fix * fix * expand light groups * more logging * sort * Revert is_proactively_adapting checks This reverts commit 39fd8f2be0f3d6bef27705d167b5eab8113d5709. * simplify the mapping * Revert "Revert is_proactively_adapting checks" This reverts commit 18803e8e507c9b44934e15320c1bbed7fa30b788. * test * no light groups * do not expand * Do not expand_light_groups in intercept * more logging * Fix * add comment * Add multi_light_intercept config option * Update README.md, strings.json, and services.yaml * add light group * fix platform * add simple test * turn off again * Test without take over control * improve test and fix it in one way * Fixes * add cleanup fixture * format * Update test_switch.py * add __str__ * remove unneeded call * simplify service_data construction * Generalize is_our_context * Fix multi_light_intercept: false * add comments * add docs * Update README.md, strings.json, and services.yaml * Add feature line * move function --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 17:47:09 -07:00
)
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# Switch identifiers used as suffixes on each AL profile's entities.
# Sleep-mode switch (`SLEEP_MODE_SWITCH`) is intentionally removed in this
# fork — see design.md decision 7.
ADAPT_COLOR_SWITCH = "adapt_color_switch"
ADAPT_BRIGHTNESS_SWITCH = "adapt_brightness_switch"
ATTR_ADAPTIVE_LIGHTING_MANAGER = "manager"
UNDO_UPDATE_LISTENER = "undo_update_listener"
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# Runtime range number-entity declarations. Each tuple drives both the
# number platform's entity creation and the curve-math read path. The
# `field_key` becomes the entity's unique-id suffix; the `conf_key` ties
# the entity back to its initial-seed value in `entry.options`.
# Design decisions 5, 6, 11 — see add-runtime-range-controls/design.md.
# Naming: "lower/upper" (not "min/max") so the device page — which sorts
# entities alphabetically by name — lists min before max for each quantity.
RANGE_ENTITIES: list[dict[str, Any]] = [
{
"field_key": "min_brightness",
"conf_key": CONF_MIN_BRIGHTNESS,
"default": DEFAULT_MIN_BRIGHTNESS,
"name": "Brightness lower",
"native_min": 1,
"native_max": 100,
"step": 1,
"unit": "%",
"icon": "mdi:brightness-3",
},
{
"field_key": "max_brightness",
"conf_key": CONF_MAX_BRIGHTNESS,
"default": DEFAULT_MAX_BRIGHTNESS,
"name": "Brightness upper",
"native_min": 1,
"native_max": 100,
"step": 1,
"unit": "%",
"icon": "mdi:brightness-7",
},
{
"field_key": "min_color_temp",
"conf_key": CONF_MIN_COLOR_TEMP,
"default": DEFAULT_MIN_COLOR_TEMP,
"name": "Color temp lower",
"native_min": 1000,
"native_max": 10000,
"step": 100,
"unit": "K",
"icon": "mdi:thermometer-low",
},
{
"field_key": "max_color_temp",
"conf_key": CONF_MAX_COLOR_TEMP,
"default": DEFAULT_MAX_COLOR_TEMP,
"name": "Color temp upper",
"native_min": 1000,
"native_max": 10000,
"step": 100,
"unit": "K",
"icon": "mdi:thermometer-high",
},
]
# Ramp half-width number-entity declaration (add-runtime-ramp-width R1, D2).
# Kept OUT of RANGE_ENTITIES: it has no `entry.options` mirror, so the
# options-seeding code paths that iterate the four range fields must not
# pick it up. One value drives BOTH the sunrise and sunset ramps (D1); the
# total transition is 2x this value. Unit is minutes; curve consumes seconds.
RAMP_WIDTH_ENTITY: dict[str, Any] = {
"field_key": CONF_RAMP_HALF_WIDTH,
"default": DEFAULT_RAMP_HALF_WIDTH_MIN,
"name": "Ramp half-width",
"native_min": 5,
"native_max": 120,
"step": 1,
"unit": "min",
"icon": "mdi:transition",
}
Implement add-output-sensors: 36/41 tasks complete Three sensor entities per AL profile expose the curve's current outputs plus actual sun elevation as graphable numerics with SensorStateClass.MEASUREMENT, so HA's recorder + apexcharts-card chart them natively: - sensor.<profile>_output_brightness (% — from self._settings) - sensor.<profile>_output_color_temp (K — from self._settings) - sensor.<profile>_sun_elevation (° — from sun.sun.attributes.elevation) Architecture: master switch publishes computed outputs to hass.data[DOMAIN][entry_id]["outputs"] after each curve tick, then fires a per-entry dispatcher signal. Sensors subscribe and read from the cache. Single computation path, push-based updates, no polling. The existing master switch attributes (brightness_pct, color_temp_kelvin, synthetic sun_position in [-1,+1]) are unchanged — sensors are purely additive. Manifest bumped to 2.2.0-cdit.1 (minor; no breaking changes). Artifact realignment along the way: Q2 answer assumed sun_position was Sun2 elevation degrees, but reading color_and_brightness.py revealed it's a synthetic float in [-1,+1] derived from the brightness curve. Switched to pulling actual elevation from sun.sun (Decision 8 added), renamed sensor from sun_position to sun_elevation. Friendly names use asymmetric "Output" prefix to dodge collision with the adapt-brightness switch and Min/Max color-temp numbers. Remaining: group 6 (manual live-HA verification on homeassistant.onca-blenny.ts.net) — requires HACS deploy. 15 new sensor tests pass; full suite green (123/123). openspec validate --strict green. ruff clean on new files.
2026-05-21 10:11:52 +02:00
# Output sensor declarations (add-output-sensors / R1, D4, D7).
# Each dict drives one read-only `sensor` entity per AL profile. The `key`
# becomes both the sensor's unique-id suffix AND the cache-dict key in
# `hass.data[DOMAIN][entry_id]["outputs"]`, so the sensor reads
# `outputs[self._output_key]` with no intermediate mapping.
OUTPUT_SENSORS: list[dict[str, Any]] = [
{
"key": "output_brightness",
"name": "Output brightness",
"unit": "%",
"icon": "mdi:brightness-percent",
},
{
"key": "output_color_temp",
"name": "Output color temp",
"unit": "K",
"icon": "mdi:thermometer",
},
{
"key": "sun_elevation",
"name": "Sun elevation",
"unit": "°",
"icon": "mdi:weather-sunset",
},
{
"key": "ambient_lux",
"name": "Ambient lux",
"unit": "lx",
"icon": "mdi:brightness-5",
"conditional": True,
},
{
"key": "lux_reduction",
"name": "Lux reduction",
"unit": "%",
"icon": "mdi:chart-line-variant",
"conditional": True,
},
Implement add-output-sensors: 36/41 tasks complete Three sensor entities per AL profile expose the curve's current outputs plus actual sun elevation as graphable numerics with SensorStateClass.MEASUREMENT, so HA's recorder + apexcharts-card chart them natively: - sensor.<profile>_output_brightness (% — from self._settings) - sensor.<profile>_output_color_temp (K — from self._settings) - sensor.<profile>_sun_elevation (° — from sun.sun.attributes.elevation) Architecture: master switch publishes computed outputs to hass.data[DOMAIN][entry_id]["outputs"] after each curve tick, then fires a per-entry dispatcher signal. Sensors subscribe and read from the cache. Single computation path, push-based updates, no polling. The existing master switch attributes (brightness_pct, color_temp_kelvin, synthetic sun_position in [-1,+1]) are unchanged — sensors are purely additive. Manifest bumped to 2.2.0-cdit.1 (minor; no breaking changes). Artifact realignment along the way: Q2 answer assumed sun_position was Sun2 elevation degrees, but reading color_and_brightness.py revealed it's a synthetic float in [-1,+1] derived from the brightness curve. Switched to pulling actual elevation from sun.sun (Decision 8 added), renamed sensor from sun_position to sun_elevation. Friendly names use asymmetric "Output" prefix to dodge collision with the adapt-brightness switch and Min/Max color-temp numbers. Remaining: group 6 (manual live-HA verification on homeassistant.onca-blenny.ts.net) — requires HACS deploy. 15 new sensor tests pass; full suite green (123/123). openspec validate --strict green. ruff clean on new files.
2026-05-21 10:11:52 +02:00
]
# Dispatcher signal used by the master switch to wake the output sensors
# after each curve tick. Keyed per config entry so two profiles don't
# cross-update. Format with `.format(entry_id=...)` at call/connect time.
SIGNAL_OUTPUTS_UPDATED = f"{DOMAIN}_{{entry_id}}_outputs_updated"
ATTR_ADAPT_COLOR = "adapt_color"
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[ATTR_ADAPT_COLOR] = "Adjust the color of supporting lights over the day."
ATTR_ADAPT_BRIGHTNESS = "adapt_brightness"
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[ATTR_ADAPT_BRIGHTNESS] = "Adjust the brightness of supporting lights over the day."
2020-09-23 12:35:57 +02:00
2020-09-25 16:45:10 +02:00
SERVICE_APPLY = "apply"
2020-09-29 23:39:46 +02:00
CONF_TURN_ON_LIGHTS = "turn_on_lights"
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
DOCS[CONF_TURN_ON_LIGHTS] = "Also turn on any targeted lights that are currently off."
SERVICE_CHANGE_SWITCH_SETTINGS = "change_switch_settings"
CONF_USE_DEFAULTS = "use_defaults"
DOCS[CONF_USE_DEFAULTS] = (
"Source for any field not supplied in this call: "
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
'"current" (keep existing values), "factory" (documented defaults), '
'or "configuration" (the profile\'s own configured defaults).'
)
TURNING_OFF_DELAY = 5
DOCS_APPLY = {
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
CONF_ENTITY_ID: "The master switch whose curve settings to apply.",
CONF_LIGHTS: "Lights to apply the settings to.",
}
2020-09-23 18:20:25 +02:00
2025-11-27 21:01:05 +01:00
def int_between(min_int: int, max_int: int) -> vol.All:
2020-09-27 16:21:42 +02:00
"""Return an integer between 'min_int' and 'max_int'."""
return vol.All(vol.Coerce(int), vol.Range(min=min_int, max=max_int))
2020-09-23 18:20:25 +02:00
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# Per-field validation tuples driving YAML import and (via maybe_coerce)
# the YAML schema. The UI options flow does not consume this list directly;
# config_flow.py hand-shapes its sections via HA selectors. Eighteen entries:
# 16 retained from upstream + 2 new sun-entity fields.
2025-11-27 21:01:05 +01:00
VALIDATION_TUPLES: list[tuple[str, Any, Any]] = [
(CONF_LIGHTS, DEFAULT_LIGHTS, cv.entity_ids), # type: ignore[arg-type]
2020-09-23 18:20:25 +02:00
(CONF_INTERVAL, DEFAULT_INTERVAL, cv.positive_int),
(CONF_TRANSITION, DEFAULT_TRANSITION, VALID_TRANSITION),
(CONF_INITIAL_TRANSITION, DEFAULT_INITIAL_TRANSITION, VALID_TRANSITION),
2020-09-23 18:20:25 +02:00
(CONF_MIN_BRIGHTNESS, DEFAULT_MIN_BRIGHTNESS, int_between(1, 100)),
2020-10-05 14:41:21 +02:00
(CONF_MAX_BRIGHTNESS, DEFAULT_MAX_BRIGHTNESS, int_between(1, 100)),
2020-09-23 18:20:25 +02:00
(CONF_MIN_COLOR_TEMP, DEFAULT_MIN_COLOR_TEMP, int_between(1000, 10000)),
2020-10-05 14:41:21 +02:00
(CONF_MAX_COLOR_TEMP, DEFAULT_MAX_COLOR_TEMP, int_between(1000, 10000)),
(CONF_PREFER_RGB_COLOR, DEFAULT_PREFER_RGB_COLOR, bool),
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
(CONF_SUNRISE_ENTITY, DEFAULT_SUNRISE_ENTITY, cv.entity_id),
(CONF_SUNSET_ENTITY, DEFAULT_SUNSET_ENTITY, cv.entity_id),
(CONF_SEPARATE_TURN_ON_COMMANDS, DEFAULT_SEPARATE_TURN_ON_COMMANDS, bool),
(CONF_SEND_SPLIT_DELAY, DEFAULT_SEND_SPLIT_DELAY, int_between(0, 10000)),
(CONF_ADAPT_DELAY, DEFAULT_ADAPT_DELAY, cv.positive_float),
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
(CONF_SKIP_REDUNDANT_COMMANDS, DEFAULT_SKIP_REDUNDANT_COMMANDS, bool),
(CONF_INTERCEPT, DEFAULT_INTERCEPT, bool),
Implement call intercept for multiple lights (#679) * Implement call intercept for multiple lights * remove comment * skip if no eids * add comment * fix type * Fix skipped * indentation * Add logging and fix error * Fix for HA ≤2023.04 * simplify * remove unused ignores * Debug mode * Add test * Make test failing * rename switch * rename lights * Fix tests * Rename lights in tests * Remove unused dependencies * Improve tests * More tests * Remove the DEBUG_MODE * Add doc-string * Extra test * assert * extra test * Comments * fix * fix * expand light groups * more logging * sort * Revert is_proactively_adapting checks This reverts commit 39fd8f2be0f3d6bef27705d167b5eab8113d5709. * simplify the mapping * Revert "Revert is_proactively_adapting checks" This reverts commit 18803e8e507c9b44934e15320c1bbed7fa30b788. * test * no light groups * do not expand * Do not expand_light_groups in intercept * more logging * Fix * add comment * Add multi_light_intercept config option * Update README.md, strings.json, and services.yaml * add light group * fix platform * add simple test * turn off again * Test without take over control * improve test and fix it in one way * Fixes * add cleanup fixture * format * Update test_switch.py * add __str__ * remove unneeded call * simplify service_data construction * Generalize is_our_context * Fix multi_light_intercept: false * add comments * add docs * Update README.md, strings.json, and services.yaml * Add feature line * move function --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 17:47:09 -07:00
(CONF_MULTI_LIGHT_INTERCEPT, DEFAULT_MULTI_LIGHT_INTERCEPT, bool),
(CONF_INCLUDE_CONFIG_IN_ATTRIBUTES, DEFAULT_INCLUDE_CONFIG_IN_ATTRIBUTES, bool),
(CONF_LUX_SENSOR, DEFAULT_LUX_SENSOR, cv.string),
(CONF_TARGET_LUX, DEFAULT_TARGET_LUX, int_between(0, 10000)),
2020-09-23 12:35:57 +02:00
]
2020-09-23 18:20:25 +02:00
2020-09-24 20:41:24 +02:00
2025-11-27 21:01:05 +01:00
def timedelta_as_int(value: timedelta) -> float:
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
"""Convert a `datetime.timedelta` object to an integer."""
2020-09-24 20:41:24 +02:00
return value.total_seconds()
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
# Only CONF_INTERVAL still needs YAML-time coercion (HA accepts strings like
# "00:01:30" and turns them into timedeltas). All other coerced fields
# (sun times, brightness-mode windows) were removed.
2025-11-27 21:01:05 +01:00
EXTRA_VALIDATION: dict[str, tuple[Any, Any]] = {
2020-09-24 20:41:24 +02:00
CONF_INTERVAL: (cv.time_period, timedelta_as_int),
2020-09-23 18:20:25 +02:00
}
2025-11-27 21:01:05 +01:00
def maybe_coerce(key: str, validation: Any) -> vol.All | Any:
"""Coerce the validation into a json serializable type."""
2020-09-24 23:42:21 +02:00
validation, coerce = EXTRA_VALIDATION.get(key, (validation, None))
if coerce is not None:
return vol.All(validation, vol.Coerce(coerce))
return validation
2020-09-24 20:41:24 +02:00
2020-09-23 18:20:25 +02:00
2020-09-26 13:05:27 +02:00
_yaml_validation_tuples = [
2020-09-25 10:33:49 +02:00
(key, default, maybe_coerce(key, validation))
2020-09-24 23:42:21 +02:00
for key, default, validation in VALIDATION_TUPLES
] + [(CONF_NAME, DEFAULT_NAME, cv.string)]
_DOMAIN_SCHEMA = vol.Schema(
{
Implement cdit-config-redesign groups 1-6 (30/53 tasks) const.py: - Drop 21 retired CONF_*/DEFAULT_* (sleep cluster, manual sun timing, brightness curve variants, take-over-control cluster). - Add CONF_SUNRISE_ENTITY / CONF_SUNSET_ENTITY (default sensor.sun_next_rising / _setting). - Add RAMP_HALF_WIDTH_SECONDS = 1800. - Add CONFIG_ENTRY_VERSION = 2 (gate for strict version-break). - Re-default DEFAULT_MIN_BRIGHTNESS 1→5, DEFAULT_MIN_COLOR_TEMP 2000→2200. - Update ICON_MAIN / _BRIGHTNESS / _COLOR_TEMP to the CDiT picks. manifest.json: bump to 2.0.0-cdit.1, pin homeassistant: 2025.1.0, re-point codeowners/documentation/issue_tracker to the CaseyRo fork. switch.py: - Drop sleep_mode_switch creation in async_setup_entry; integration now creates 3 switches per profile (master, adapt_color, adapt_brightness). - Strip sleep-mode state machine from AdaptiveSwitch (sleep_mode_switch attribute, sleep_transition, adapt_until_sleep, the state-change listener, the _sleep_mode_switch_state_event_action method). - Bridge-stub _take_over_control / _detect_non_ha_changes / _adapt_only_on_bare_turn_on / _only_once / _auto_reset_manual_control_time as class-level False/0 so Manager-side branches become dead code without needing a full rewrite of AdaptiveLightingManager. - Remove handle_set_manual_control service + its registration. - Replace astral-driven curve init with the new SunLightSettings call shape; add AdaptiveSwitch._today_sun_events() helper that reads the configured sunrise/sunset entities. - Set _attr_icon on AdaptiveSwitch. color_and_brightness.py: - Rewrite SunLightSettings as a pure curve-math wrapper (5 fields: name + bounds + ramp half-width); methods take t_sunrise/t_sunset as args, never reads HA state. - Implement piecewise tanh ramp curve per spec R4 / design D11 in _tanh_day_curve(). Both brightness and color-temp use the same shape. - Drop SunEvents, sleep-mode branches, brightness_mode-switch, astral dependency, force_rgb_color, lerp_color_hsv sleep-tinted color blending. config_flow.py: - Rewrite as sectioned schema (Targets / Daytime curve / Sun schedule / Light control / Advanced / Diagnostics) via HA's section() helper. - Native HA selectors throughout (NumberSelector, EntitySelector, BooleanSelector). Strict typing on sun-event entity pickers. - Conditional visibility for send_split_delay (driver: separate_turn_on_commands). - Extend OptionsFlowWithReload (with ImportError fallback for HA < 2025.1 dev environment); async_abort(reason="yaml_managed") for SOURCE_IMPORT. - VERSION = CONFIG_ENTRY_VERSION. __init__.py: - Reject older config entries with ConfigEntryError ("recreate the entry") per spec R8 / design D4. - Add _remove_orphan_sleep_entities tombstone helper that scans the entity registry for sleep-mode entities owned by this entry and removes them on first setup. Idempotent and config_entry-scoped. _docs_helpers.py: stub the removed DOCS_MANUAL_CONTROL / SET_MANUAL_CONTROL_SCHEMA so the docs-generator script keeps importing. Validation: - ALL modules import cleanly under HA 2024.12.5 (dev env). - openspec validate cdit-config-redesign --strict: green. - ruff check --select=F: clean. Remaining: groups 7 (16 tests), 8 (strings + plain-language pass), 9 (docs).
2026-05-16 14:27:39 +02:00
vol.Optional(key, default=default): validation
2020-09-26 13:05:27 +02:00
for key, default, validation in _yaml_validation_tuples
},
2020-09-24 23:42:21 +02:00
)
2025-11-27 21:01:05 +01:00
def apply_service_schema(initial_transition: int = 1) -> vol.Schema:
"""Return the schema for the apply service."""
return vol.Schema(
{
2025-11-27 21:01:05 +01:00
vol.Optional(CONF_ENTITY_ID): cv.entity_ids, # type: ignore[arg-type]
vol.Optional(CONF_LIGHTS, default=[]): cv.entity_ids, # type: ignore[arg-type]
vol.Optional(
CONF_TRANSITION,
default=initial_transition,
): VALID_TRANSITION,
vol.Optional(ATTR_ADAPT_BRIGHTNESS, default=True): cv.boolean,
vol.Optional(ATTR_ADAPT_COLOR, default=True): cv.boolean,
vol.Optional(CONF_PREFER_RGB_COLOR, default=False): cv.boolean,
vol.Optional(CONF_TURN_ON_LIGHTS, default=False): cv.boolean,
},
)