Fix autorestore logic and protocol badge per device type

Autorestore fixes:
- Snapshot WLED state before connect() mutates it (lor, AudioReactive)
- Gate restore on auto_shutdown setting (was unconditional)
- Remove misleading auto_restore capability from serial provider
- Default auto_shutdown to false for all new devices

Protocol badge fixes:
- Show correct protocol per device type (OpenRGB SDK, MQTT, WebSocket)
- Was showing "Serial" for all non-WLED devices

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 10:04:40 +03:00
parent 96bd3bd0f0
commit 8061c26bef
9 changed files with 44 additions and 12 deletions

View File

@@ -165,6 +165,7 @@ class ProcessorManager:
send_latency_ms=send_latency_ms,
rgbw=rgbw,
zone_mode=ds.zone_mode,
auto_shutdown=ds.auto_shutdown,
)
# ===== EVENT SYSTEM (state change notifications) =====

View File

@@ -75,6 +75,7 @@ class DeviceInfo:
send_latency_ms: int = 0
rgbw: bool = False
zone_mode: str = "combined"
auto_shutdown: bool = False
@dataclass

View File

@@ -197,9 +197,11 @@ class WledTargetProcessor(TargetProcessor):
self._task = None
await asyncio.sleep(0.05)
# Restore device state
# Restore device state (only if auto_shutdown is enabled)
if self._led_client and self._device_state_before:
await self._led_client.restore_device_state(self._device_state_before)
device_info = self._ctx.get_device_info(self._device_id)
if device_info and device_info.auto_shutdown:
await self._led_client.restore_device_state(self._device_state_before)
self._device_state_before = None
# Close LED connection