Files
led2/lightsync/models/device.py
Claude 061edfcf6a feat(01-01): create package structure, Pydantic models, and device abstractions
- pyproject.toml with FastAPI, uvicorn, Pydantic v2, aiofiles, structlog deps
- DeviceConfig Pydantic model with StripType, UUID, validation constraints
- ShowModel with AudioRef, TrackModel, CueModel, AnalysisBlock, schema_version=1
- BaseDevice ABC with encode_frame, encode_animation_cmd, bytes_per_pixel
- SK6812Device (4 bytes/pixel) and WS2801Device (3 bytes/pixel) implementations
2026-04-05 18:45:19 +00:00

18 lines
427 B
Python

from uuid import UUID, uuid4
from typing import Literal
from pydantic import BaseModel, Field
StripType = Literal["sk6812", "ws2801", "generic"]
class DeviceConfig(BaseModel):
id: UUID = Field(default_factory=uuid4)
name: str
strip_type: StripType
led_count: int = Field(gt=0, le=1000)
ip: str
port: int = Field(ge=1, le=65535)
enabled: bool = True
model_config = {"populate_by_name": True}