Remove idle color feature, simplify power to turn-off only, fix settings serial port bug
- Remove static/idle color from entire stack (storage, API, processing, UI, CSS, locales) - Simplify device power button to turn-off only (send black frame, no toggle) - Send black frame on serial port close (AdalightClient.close) - Fix settings modal serial port dropdown showing WLED devices due to stale deviceType Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import json
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from wled_controller.utils import get_logger
|
||||
|
||||
@@ -30,7 +30,6 @@ class Device:
|
||||
baud_rate: Optional[int] = None,
|
||||
software_brightness: int = 255,
|
||||
auto_shutdown: bool = False,
|
||||
static_color: Optional[Tuple[int, int, int]] = None,
|
||||
created_at: Optional[datetime] = None,
|
||||
updated_at: Optional[datetime] = None,
|
||||
):
|
||||
@@ -43,7 +42,6 @@ class Device:
|
||||
self.baud_rate = baud_rate
|
||||
self.software_brightness = software_brightness
|
||||
self.auto_shutdown = auto_shutdown
|
||||
self.static_color = static_color
|
||||
self.created_at = created_at or datetime.utcnow()
|
||||
self.updated_at = updated_at or datetime.utcnow()
|
||||
# Preserved from old JSON for migration — not written back
|
||||
@@ -67,8 +65,6 @@ class Device:
|
||||
d["software_brightness"] = self.software_brightness
|
||||
if self.auto_shutdown:
|
||||
d["auto_shutdown"] = True
|
||||
if self.static_color is not None:
|
||||
d["static_color"] = list(self.static_color)
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
@@ -78,9 +74,6 @@ class Device:
|
||||
Backward-compatible: reads legacy 'calibration' field and stores it
|
||||
in _legacy_calibration for migration use only.
|
||||
"""
|
||||
static_color_raw = data.get("static_color")
|
||||
static_color = tuple(static_color_raw) if static_color_raw else None
|
||||
|
||||
device = cls(
|
||||
device_id=data["id"],
|
||||
name=data["name"],
|
||||
@@ -91,7 +84,6 @@ class Device:
|
||||
baud_rate=data.get("baud_rate"),
|
||||
software_brightness=data.get("software_brightness", 255),
|
||||
auto_shutdown=data.get("auto_shutdown", False),
|
||||
static_color=static_color,
|
||||
created_at=datetime.fromisoformat(data.get("created_at", datetime.utcnow().isoformat())),
|
||||
updated_at=datetime.fromisoformat(data.get("updated_at", datetime.utcnow().isoformat())),
|
||||
)
|
||||
@@ -250,18 +242,6 @@ class DeviceStore:
|
||||
logger.info(f"Updated device {device_id}")
|
||||
return device
|
||||
|
||||
def set_static_color(
|
||||
self, device_id: str, color: Optional[Tuple[int, int, int]]
|
||||
) -> "Device":
|
||||
"""Set or clear the static idle color for a device."""
|
||||
device = self._devices.get(device_id)
|
||||
if not device:
|
||||
raise ValueError(f"Device {device_id} not found")
|
||||
device.static_color = color
|
||||
device.updated_at = datetime.utcnow()
|
||||
self.save()
|
||||
return device
|
||||
|
||||
def delete_device(self, device_id: str):
|
||||
"""Delete device."""
|
||||
if device_id not in self._devices:
|
||||
|
||||
Reference in New Issue
Block a user