from lightsync.devices.base import BaseDevice from lightsync.models.device import DeviceConfig class WS2801Device(BaseDevice): """WS2801 RGB LED strip — 3 bytes per pixel (R, G, B).""" def __init__(self, config: DeviceConfig): super().__init__(config) @property def bytes_per_pixel(self) -> int: return 3 def encode_frame(self, pixels: list[tuple]) -> bytes: """Encode pixel list to WS2801 frame bytes. Each pixel: (r, g, b) tuple — 3 bytes per LED. """ buf = bytearray() for pixel in pixels: r, g, b = pixel[0], pixel[1], pixel[2] buf.extend([r & 0xFF, g & 0xFF, b & 0xFF]) return bytes(buf) def encode_animation_cmd(self, animation: str, params: dict) -> bytes: """Stub — Phase 3 implements real animation command encoding.""" return b""