Add OpenRGB per-zone LED control with separate/combined modes and zone preview

- Zone picker UI in device add/settings modals with per-zone checkbox selection
- Combined mode: pixels distributed sequentially across zones
- Separate mode: full effect resampled independently to each zone via linear interpolation
- Per-zone LED preview in target cards: one canvas strip per zone with hover overlay labels
- Zone badges on device cards enriched with actual LED counts from OpenRGB API
- Fix stale led_count by using device_led_count discovered at connect time

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 20:35:51 +03:00
parent aafcf83896
commit 52ee4bdeb6
19 changed files with 769 additions and 55 deletions

View File

@@ -17,6 +17,7 @@ class DeviceCreate(BaseModel):
auto_shutdown: Optional[bool] = Field(default=None, description="Turn off device when server stops (defaults to true for adalight)")
send_latency_ms: Optional[int] = Field(None, ge=0, le=5000, description="Simulated send latency in ms (mock devices)")
rgbw: Optional[bool] = Field(None, description="RGBW mode (mock devices)")
zone_mode: Optional[str] = Field(None, description="OpenRGB zone mode: combined or separate")
class DeviceUpdate(BaseModel):
@@ -30,6 +31,7 @@ class DeviceUpdate(BaseModel):
auto_shutdown: Optional[bool] = Field(None, description="Turn off device when server stops")
send_latency_ms: Optional[int] = Field(None, ge=0, le=5000, description="Simulated send latency in ms (mock devices)")
rgbw: Optional[bool] = Field(None, description="RGBW mode (mock devices)")
zone_mode: Optional[str] = Field(None, description="OpenRGB zone mode: combined or separate")
class Calibration(BaseModel):
@@ -99,6 +101,7 @@ class DeviceResponse(BaseModel):
auto_shutdown: bool = Field(default=False, description="Restore device to idle state when targets stop")
send_latency_ms: int = Field(default=0, description="Simulated send latency in ms (mock devices)")
rgbw: bool = Field(default=False, description="RGBW mode (mock devices)")
zone_mode: str = Field(default="combined", description="OpenRGB zone mode: combined or separate")
capabilities: List[str] = Field(default_factory=list, description="Device type capabilities")
created_at: datetime = Field(description="Creation timestamp")
updated_at: datetime = Field(description="Last update timestamp")
@@ -149,3 +152,18 @@ class DiscoverDevicesResponse(BaseModel):
devices: List[DiscoveredDeviceResponse] = Field(description="Discovered devices")
count: int = Field(description="Total devices found")
scan_duration_ms: float = Field(description="How long the scan took in milliseconds")
class OpenRGBZoneResponse(BaseModel):
"""A single zone on an OpenRGB device."""
name: str = Field(description="Zone name (e.g. JRAINBOW2)")
led_count: int = Field(description="Number of LEDs in this zone")
zone_type: str = Field(description="Zone type (linear, single, matrix)")
class OpenRGBZonesResponse(BaseModel):
"""Response from OpenRGB zone listing."""
device_name: str = Field(description="OpenRGB device name")
zones: List[OpenRGBZoneResponse] = Field(description="Available zones")