feat: HA light output targets — cast LED colors to Home Assistant lights
Lint & Test / test (push) Has been cancelled

New output target type `ha_light` that sends averaged LED colors to HA
light entities via WebSocket service calls (light.turn_on/turn_off):

Backend:
- HARuntime.call_service(): fire-and-forget WS service calls
- HALightOutputTarget: data model with light mappings, update rate, transition
- HALightTargetProcessor: processing loop with delta detection, rate limiting
- ProcessorManager.add_ha_light_target(): registration
- API schemas/routes updated for ha_light target type

Frontend:
- HA Light Targets section in Targets tab tree nav
- Modal editor: HA source picker, CSS source picker, light entity mappings
- Target cards with start/stop/clone/edit actions
- i18n keys for all new UI strings
This commit is contained in:
2026-03-28 00:08:49 +03:00
parent fb98e6e2b8
commit cb9289f01f
25 changed files with 1679 additions and 164 deletions
@@ -21,14 +21,24 @@ class OutputTarget:
"""Register this target with the processor manager. Subclasses override."""
pass
def sync_with_manager(self, manager, *, settings_changed: bool, source_changed: bool, device_changed: bool) -> None:
def sync_with_manager(
self, manager, *, settings_changed: bool, source_changed: bool, device_changed: bool
) -> None:
"""Push changed fields to a running processor. Subclasses override."""
pass
def update_fields(self, *, name=None, device_id=None, picture_source_id=None,
settings=None, key_colors_settings=None, description=None,
tags: Optional[List[str]] = None,
**_kwargs) -> None:
def update_fields(
self,
*,
name=None,
device_id=None,
picture_source_id=None,
settings=None,
key_colors_settings=None,
description=None,
tags: Optional[List[str]] = None,
**_kwargs,
) -> None:
"""Apply mutable field updates. Base handles common fields; subclasses handle type-specific ones."""
if name is not None:
self.name = name
@@ -60,8 +70,14 @@ class OutputTarget:
target_type = data.get("target_type", "led")
if target_type == "led":
from wled_controller.storage.wled_output_target import WledOutputTarget
return WledOutputTarget.from_dict(data)
if target_type == "key_colors":
from wled_controller.storage.key_colors_output_target import KeyColorsOutputTarget
return KeyColorsOutputTarget.from_dict(data)
if target_type == "ha_light":
from wled_controller.storage.ha_light_output_target import HALightOutputTarget
return HALightOutputTarget.from_dict(data)
raise ValueError(f"Unknown target type: {target_type}")