mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-14 07:44:04 +02:00
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> |
||
|---|---|---|
| .. | ||
| translations | ||
| __init__.py | ||
| _docs_helpers.py | ||
| adaptation_utils.py | ||
| color_and_brightness.py | ||
| config_flow.py | ||
| const.py | ||
| diagnostics.py | ||
| docs_gen.py | ||
| hass_utils.py | ||
| helpers.py | ||
| manifest.json | ||
| number.py | ||
| services.yaml | ||
| strings.json | ||
| switch.py | ||