Add mock LED device type for testing without hardware
Virtual device with configurable LED count, RGB/RGBW mode, and simulated send latency. Includes full provider/client implementation, API schema support, and frontend add/settings modal integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,15 @@ class ProcessorManager:
|
||||
ds = self._devices.get(device_id)
|
||||
if ds is None:
|
||||
return None
|
||||
# Read mock-specific fields from persistent storage
|
||||
send_latency_ms = 0
|
||||
rgbw = False
|
||||
if self._device_store:
|
||||
dev = self._device_store.get_device(ds.device_id)
|
||||
if dev:
|
||||
send_latency_ms = getattr(dev, "send_latency_ms", 0)
|
||||
rgbw = getattr(dev, "rgbw", False)
|
||||
|
||||
return DeviceInfo(
|
||||
device_id=ds.device_id,
|
||||
device_url=ds.device_url,
|
||||
@@ -137,6 +146,8 @@ class ProcessorManager:
|
||||
baud_rate=ds.baud_rate,
|
||||
software_brightness=ds.software_brightness,
|
||||
test_mode_active=ds.test_mode_active,
|
||||
send_latency_ms=send_latency_ms,
|
||||
rgbw=rgbw,
|
||||
)
|
||||
|
||||
# ===== EVENT SYSTEM (state change notifications) =====
|
||||
|
||||
@@ -69,6 +69,8 @@ class DeviceInfo:
|
||||
baud_rate: Optional[int] = None
|
||||
software_brightness: int = 255
|
||||
test_mode_active: bool = False
|
||||
send_latency_ms: int = 0
|
||||
rgbw: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -86,6 +86,8 @@ class WledTargetProcessor(TargetProcessor):
|
||||
device_info.device_type, device_info.device_url,
|
||||
use_ddp=True, led_count=device_info.led_count,
|
||||
baud_rate=device_info.baud_rate,
|
||||
send_latency_ms=device_info.send_latency_ms,
|
||||
rgbw=device_info.rgbw,
|
||||
)
|
||||
await self._led_client.connect()
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user