- Remove DeviceBrightnessSnapshot and AutomationSnapshot from scene data model - Simplify capture_current_snapshot and apply_scene_state to targets only - Remove device/automation dependencies from scene preset API routes - Add target selector (combobox + add/remove) to scene capture modal - Fix stale profiles reference bug in scene_preset_store recapture - Update automation engine call sites for simplified scene functions - Sync scene presets cache between automations and scene-presets modules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.5 KiB
Python
57 lines
1.5 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
|
|
auto_start: bool = False
|
|
|
|
|
|
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")
|
|
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)
|
|
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]
|
|
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)
|