adaptive-lighting/custom_components/adaptive_lighting
proscar87 55f871fd0c
Adopt has_entity_name to fix duplicated entity ids on HA 2026.4+ (#1499)
* Adopt has_entity_name to fix duplicated entity ids on HA 2026.4+

Since HA core 2026.4 (PR 166246) composes entity names as device name +
entity name, and only strips the device prefix when the entity name
starts with it. Adaptive Lighting's names ('Adaptive Lighting Sleep
Mode: stairs' on device 'Adaptive Lighting: stairs') never match, so
new installs get ids like
switch.adaptive_lighting_stairs_adaptive_lighting_sleep_mode_stairs.

Adopt has_entity_name: the main switch takes the device name
('Adaptive Lighting: <name>'), the simple switches use their role
('Sleep Mode', 'Adapt Brightness', 'Adapt Color'). Unique ids are
unchanged, so existing installs keep their entity ids via the registry.

Fixes #1459

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

* Test the new entity ids and that existing ones survive

The renamed constants were defined but never asserted, so neither the
fresh-install ids nor the registry-preservation claim were covered.

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

* test: keep the apply-service test light on

Avoid generating brightness zero in the attribute-change helper, which turns the light off and makes the test depend on the current adaptive brightness.

---------

Co-authored-by: proscar87 <proscar87@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2026-09-06 09:18:49 +02: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 Adopt has_entity_name to fix duplicated entity ids on HA 2026.4+ (#1499) 2026-09-06 09:18:49 +02:00