Add profile conditions, scene presets, MQTT integration, and Scenes tab
Feature 1 — Profile Conditions: time-of-day, system idle (Win32 GetLastInputInfo), and display state (GUID_CONSOLE_DISPLAY_STATE) condition types for automatic profile activation. Feature 2 — Scene Presets: snapshot/restore system that captures target running states, device brightness, and profile enables. Server-side capture with 5-step activation order. Dedicated Scenes tab with CardSection-based card grid, command palette integration, and dashboard quick-activate section. Feature 3 — MQTT Integration: MQTTService singleton with aiomqtt, MQTTLEDClient device provider for pixel output, MQTT profile condition type with topic/payload matching, and frontend support for MQTT device type and condition editor. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
67
server/src/wled_controller/api/schemas/scene_presets.py
Normal file
67
server/src/wled_controller/api/schemas/scene_presets.py
Normal file
@@ -0,0 +1,67 @@
|
||||
"""Scene preset API schemas."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TargetSnapshotSchema(BaseModel):
|
||||
target_id: str
|
||||
running: bool = False
|
||||
color_strip_source_id: str = ""
|
||||
brightness_value_source_id: str = ""
|
||||
fps: int = 30
|
||||
auto_start: bool = False
|
||||
|
||||
|
||||
class DeviceBrightnessSnapshotSchema(BaseModel):
|
||||
device_id: str
|
||||
software_brightness: int = 255
|
||||
|
||||
|
||||
class ProfileSnapshotSchema(BaseModel):
|
||||
profile_id: str
|
||||
enabled: bool = True
|
||||
|
||||
|
||||
class ScenePresetCreate(BaseModel):
|
||||
"""Create a scene preset by capturing current state."""
|
||||
|
||||
name: str = Field(description="Preset name", min_length=1, max_length=100)
|
||||
description: str = Field(default="", max_length=500)
|
||||
color: str = Field(default="#4fc3f7", description="Card accent color")
|
||||
|
||||
|
||||
class ScenePresetUpdate(BaseModel):
|
||||
"""Update scene preset metadata (not snapshot data — use recapture for that)."""
|
||||
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=100)
|
||||
description: Optional[str] = Field(None, max_length=500)
|
||||
color: Optional[str] = None
|
||||
order: Optional[int] = None
|
||||
|
||||
|
||||
class ScenePresetResponse(BaseModel):
|
||||
"""Scene preset with full snapshot data."""
|
||||
|
||||
id: str
|
||||
name: str
|
||||
description: str
|
||||
color: str
|
||||
targets: List[TargetSnapshotSchema]
|
||||
devices: List[DeviceBrightnessSnapshotSchema]
|
||||
profiles: List[ProfileSnapshotSchema]
|
||||
order: int
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class ScenePresetListResponse(BaseModel):
|
||||
presets: List[ScenePresetResponse]
|
||||
count: int
|
||||
|
||||
|
||||
class ActivateResponse(BaseModel):
|
||||
status: str = Field(description="'activated' or 'partial'")
|
||||
errors: List[str] = Field(default_factory=list)
|
||||
Reference in New Issue
Block a user