feat: HA light target live color preview — per-entity swatches via WebSocket
Lint & Test / test (push) Successful in 1m24s
Lint & Test / test (push) Successful in 1m24s
- Cache per-entity colors in HALightTargetProcessor._update_lights()
- Broadcast colors_update to WS clients at target's update_rate
- WS endpoint: /api/v1/output-targets/{target_id}/ha-light/ws
- Frontend: connect WS when target runs, update swatch colors live
- Card shows colored boxes per mapped entity with entity name labels
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Tests for OutputTargetStore — CRUD for LED and key_colors targets."""
|
||||
"""Tests for OutputTargetStore — CRUD for LED and HA light targets."""
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -34,18 +34,6 @@ class TestOutputTargetModel:
|
||||
assert isinstance(target, WledOutputTarget)
|
||||
assert target.device_id == "dev_1"
|
||||
|
||||
def test_key_colors_type_rejected(self):
|
||||
"""key_colors target type removed — from_dict raises ValueError."""
|
||||
data = {
|
||||
"id": "pt_2",
|
||||
"name": "KC Target",
|
||||
"target_type": "key_colors",
|
||||
"created_at": "2025-01-01T00:00:00+00:00",
|
||||
"updated_at": "2025-01-01T00:00:00+00:00",
|
||||
}
|
||||
with pytest.raises(ValueError, match="Unknown target type"):
|
||||
OutputTarget.from_dict(data)
|
||||
|
||||
def test_unknown_type_raises(self):
|
||||
data = {
|
||||
"id": "pt_3",
|
||||
@@ -78,11 +66,6 @@ class TestOutputTargetStoreCRUD:
|
||||
assert t.name == "LED 1"
|
||||
assert store.count() == 1
|
||||
|
||||
def test_create_key_colors_target_rejected(self, store):
|
||||
"""key_colors target type is no longer supported (migrated to CSS source)."""
|
||||
with pytest.raises(ValueError, match="Invalid target type"):
|
||||
store.create_target(name="KC 1", target_type="key_colors")
|
||||
|
||||
def test_create_invalid_type(self, store):
|
||||
with pytest.raises(ValueError, match="Invalid target type"):
|
||||
store.create_target(name="Bad", target_type="invalid")
|
||||
|
||||
Reference in New Issue
Block a user