adaptive-lighting/custom_components/adaptive_lighting
Ahmad Tawakol 51e0b11860 Use the sleep RGB colour as the floor whenever it is configured
A switch with `sleep_rgb_or_color_temp: rgb_color` expresses its sleep colour
as RGB. `_apply_intensity` only walked RGB towards `sleep_rgb_color` on the
`adapt_until_sleep` path; everywhere else it re-derived RGB from the
interpolated colour temperature. Intensity 0 therefore produced
`color_temperature_to_rgb(sleep_color_temp)` rather than the configured
`sleep_rgb_color`, breaking the guarantee that 0 reproduces sleep mode.

The condition is now the switch's own configuration -- the sleep floor being in
force, and the sleep colour being expressed as RGB -- which subsumes the
`adapt_until_sleep` case and makes the `keep_rgb` parameter redundant.

The `minimum` floor still derives RGB from the colour temperature, because its
anchor is `min_color_temp`, a Kelvin, and the sleep colour is not the floor
there.

The existing test asserted the RGB match only when `force_rgb_color` was set,
so it stepped over this. Replaced with a test that asserts what was actually
promised, under both values of `adapt_until_sleep`, plus one pinning the
`minimum` floor's Kelvin-derived behaviour.

Reported by greptile-apps on #1593.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 18:47:10 -03:00
..
translations Add a per-switch intensity dial (number entity) 2026-09-07 14:15:59 -03:00
__init__.py Add a per-switch intensity dial (number entity) 2026-09-07 14:15:59 -03:00
_docs_helpers.py Register service actions in async_setup for Bronze tier compliance (#1403) 2026-09-06 13:04:18 +02:00
adaptation_utils.py Fix missing follow-up commands during multi-light interception (#1560) 2026-09-06 14:03:08 +02:00
color_and_brightness.py Use the sleep RGB colour as the floor whenever it is configured 2026-09-07 18:47:10 -03:00
config_flow.py Implement collapsible sections for options flow (#1313) 2026-09-06 17:18:42 +02:00
const.py Add a per-switch intensity dial (number entity) 2026-09-07 14:15:59 -03:00
diagnostics.py Add on-demand Home Assistant diagnostics (#1575) 2026-09-06 19:11:55 +02:00
docs_gen.py Migrate to markdown-code-runner's built-in include_section() (#1417) 2026-01-26 09:01:50 +01:00
hass_utils.py fix: track mixed targets during light turn-off (#1584) 2026-09-07 07:41:28 +02:00
helpers.py Friendly names (#1258) 2025-11-27 12:01:05 -08:00
manifest.json chore: release v1.32.0 (#1580) 2026-09-06 22:06:43 +02:00
number.py Add a per-switch intensity dial (number entity) 2026-09-07 14:15:59 -03:00
services.yaml feat: add expand_light_groups option (#1462) 2026-09-06 21:13:35 +02:00
strings.json Add a per-switch intensity dial (number entity) 2026-09-07 14:15:59 -03:00
switch.py Add a per-switch intensity dial (number entity) 2026-09-07 14:15:59 -03:00