Remove all migration logic, scroll tutorial targets into view, mock URL uses device ID

- Remove legacy migration code: profiles→automations key fallbacks, segments array
  fallback, standby_interval compat, profile_id compat, wled→led type mapping,
  legacy calibration field, audio CSS migration, default template migration,
  loadTargets alias, wled sub-tab mapping
- Scroll tutorial step targets into view when off-screen
- Mock device URL changed from mock://{led_count} to mock://{device_id},
  hide mock URL badge on device cards

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 18:31:41 +03:00
parent 39b31aec34
commit 0eb0f44ddb
12 changed files with 26 additions and 172 deletions

View File

@@ -48,8 +48,6 @@ class Device:
self.rgbw = rgbw
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
self._legacy_calibration = None
def to_dict(self) -> dict:
"""Convert device to dictionary."""
@@ -77,12 +75,8 @@ class Device:
@classmethod
def from_dict(cls, data: dict) -> "Device":
"""Create device from dictionary.
Backward-compatible: reads legacy 'calibration' field and stores it
in _legacy_calibration for migration use only.
"""
device = cls(
"""Create device from dictionary."""
return cls(
device_id=data["id"],
name=data["name"],
url=data["url"],
@@ -98,17 +92,6 @@ class Device:
updated_at=datetime.fromisoformat(data.get("updated_at", datetime.utcnow().isoformat())),
)
# Preserve old calibration for migration (never written back by to_dict)
calibration_data = data.get("calibration")
if calibration_data:
try:
from wled_controller.core.capture.calibration import calibration_from_dict
device._legacy_calibration = calibration_from_dict(calibration_data)
except Exception:
pass
return device
class DeviceStore:
"""Persistent storage for WLED devices."""
@@ -196,6 +179,10 @@ class DeviceStore:
"""Create a new device."""
device_id = f"device_{uuid.uuid4().hex[:8]}"
# Mock devices use their device ID as the URL authority
if device_type == "mock":
url = f"mock://{device_id}"
device = Device(
device_id=device_id,
name=name,