Extract SerialDeviceProvider base class and power off serial devices on shutdown
Create SerialDeviceProvider as the common base for Adalight and AmbiLED providers, replacing the misleading Adalight→AmbiLED inheritance chain. Subclasses now only override device_type and create_client(). Also send explicit black frames to all serial LED devices during server shutdown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -658,6 +658,14 @@ class ProcessorManager:
|
||||
for device_id in self._devices:
|
||||
await self._restore_device_idle_state(device_id)
|
||||
|
||||
# Power off serial LED devices before closing connections
|
||||
for device_id, ds in self._devices.items():
|
||||
if ds.device_type != "wled":
|
||||
try:
|
||||
await self._send_clear_pixels(device_id)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to power off {device_id} on shutdown: {e}")
|
||||
|
||||
# Close any cached idle LED clients
|
||||
for did in list(self._idle_clients):
|
||||
await self._close_idle_client(did)
|
||||
|
||||
Reference in New Issue
Block a user