adaptive-lighting/custom_components/adaptive_lighting
proscar87 67d4a2f657
fix: clamp() collapsed to minimum when min_brightness > max_brightness (#1507)
* fix: clamp() collapsed to minimum when min_brightness > max_brightness

A user can intentionally set min_brightness > max_brightness (or the
equivalent for color temperature) for an inverted timescale -- e.g. a
porch light that should be brighter at night than during the day.
clamp()'s max(minimum, min(value, maximum)) assumed minimum <= maximum;
when inverted, min(value, maximum) is always <= maximum < minimum, so
max(minimum, ...) always returns minimum. linear and tanh brightness
modes -- both of which end in a clamp(brightness, min_brightness,
max_brightness) call -- got stuck returning one fixed value regardless
of the time of day.

Fixes #1421

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test: accept current Home Assistant brightness validation errors

Keep asserting the maximum brightness limit without depending on the validation library's dictionary-path wording.

---------

Co-authored-by: Oscar Pacheco <proscar@MacBook-Pro-de-Oscar.local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2026-09-06 00:10:21 -07:00
..
translations fix: restore hassfest and Home Assistant CI 2026-04-24 11:31:53 -07:00
__init__.py Code cleanup (#1348) 2025-12-12 13:37:42 -08:00
_docs_helpers.py Individual manual control of brightness and color (#1356) 2025-12-22 22:55:16 -08:00
adaptation_utils.py fix: use quantization-aware comparison in skip_redundant_commands filter (#1513) 2026-09-06 06:53:06 +00:00
color_and_brightness.py fix: clamp() collapsed to minimum when min_brightness > max_brightness (#1507) 2026-09-06 00:10:21 -07:00
config_flow.py fix: restore hassfest and Home Assistant CI 2026-04-24 11:31:53 -07:00
const.py Fix regression: lights not adapting when turned on by automation (#1380) 2026-01-12 13:40:55 +01: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 Friendly names (#1258) 2025-11-27 12:01:05 -08:00
helpers.py Friendly names (#1258) 2025-11-27 12:01:05 -08:00
manifest.json Update manifest.json to v1.31.0 (#1486) 2026-07-07 09:38:26 -07:00
services.yaml Individual manual control of brightness and color (#1356) 2025-12-22 22:55:16 -08:00
strings.json fix: restore hassfest and Home Assistant CI 2026-04-24 11:31:53 -07:00
switch.py fix: re-adapt lights right after the auto-reset timer fires (#1506) 2026-09-06 07:01:50 +00:00