Files
wled-screen-controller-mixed/server/src/wled_controller/api/schemas/scene_presets.py
alexei.dolgolyov fddbd771f2 Replace auto-start with startup automation, add card colors to dashboard
- Add `startup` automation condition type that activates on server boot,
  replacing the per-target `auto_start` flag
- Remove `auto_start` field from targets, scene snapshots, and all API layers
- Remove auto-start UI section and star buttons from dashboard and target cards
- Remove `color` field from scene presets (backend, API, modal, frontend)
- Add card color support to scene preset cards (color picker + border style)
- Show localStorage-backed card colors on all dashboard cards (targets,
  automations, sync clocks, scene presets)
- Fix card color picker updating wrong card when duplicate data attributes
  exist by using closest() from picker wrapper instead of global querySelector
- Add sync clocks step to Sources tab tutorial
- Bump SW cache v9 → v10

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 01:09:27 +03:00

53 lines
1.4 KiB
Python

"""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
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)
target_ids: Optional[List[str]] = Field(None, description="Target IDs to capture (all if omitted)")
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)
order: Optional[int] = None
class ScenePresetResponse(BaseModel):
"""Scene preset with full snapshot data."""
id: str
name: str
description: str
targets: List[TargetSnapshotSchema]
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)