HA integration: fix reload loop, parallel device fetch, WS guards, translations
- Fix indentation bug causing scenes device to not register - Use nonlocal tracking to prevent infinite reload loops on target/scene changes - Guard WS start/stop to avoid redundant connections - Parallel device brightness fetching via asyncio.gather - Route set_leds service to correct coordinator by source ID - Remove stale pattern cache, reuse single timeout object - Fix translations structure for light/select entities - Unregister service when last config entry unloaded Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -63,9 +63,13 @@ class ApiInputLight(CoordinatorEntity, LightEntity):
|
||||
self._entry_id = entry_id
|
||||
self._attr_unique_id = f"{self._source_id}_light"
|
||||
|
||||
# Local state — not derived from coordinator data
|
||||
self._is_on: bool = False
|
||||
self._rgb_color: tuple[int, int, int] = (255, 255, 255)
|
||||
# Restore state from fallback_color
|
||||
fallback = self._get_fallback_color()
|
||||
is_off = fallback == [0, 0, 0]
|
||||
self._is_on: bool = not is_off
|
||||
self._rgb_color: tuple[int, int, int] = (
|
||||
(255, 255, 255) if is_off else tuple(fallback) # type: ignore[arg-type]
|
||||
)
|
||||
self._brightness: int = 255
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user