Replace HAOS light entity with select entities, add zero-brightness optimization
- Remove light.py platform (static color control via HA light entity) - Add select.py with CSS Source and Brightness Source dropdowns for LED targets - Coordinator now fetches color-strip-sources and value-sources lists - Add generic update_target() method for partial target updates - Clean up stale device registry entries on integration reload - Skip frame sends when effective brightness is ~0 (suppresses unnecessary UDP/HTTP traffic while LEDs are dark) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -577,6 +577,16 @@ class WledTargetProcessor(TargetProcessor):
|
||||
|
||||
cur_brightness = _effective_brightness(device_info)
|
||||
|
||||
# Zero-brightness suppression: if output is black and
|
||||
# the last sent frame was also black, skip sending.
|
||||
if cur_brightness <= 1 and _prev_brightness <= 1 and has_any_frame:
|
||||
self._metrics.frames_skipped += 1
|
||||
while send_timestamps and send_timestamps[0] < loop_start - 1.0:
|
||||
send_timestamps.popleft()
|
||||
self._metrics.fps_current = len(send_timestamps)
|
||||
await asyncio.sleep(SKIP_REPOLL)
|
||||
continue
|
||||
|
||||
if frame is prev_frame_ref and cur_brightness == _prev_brightness:
|
||||
# Same frame + same brightness — keepalive or skip
|
||||
if self._needs_keepalive and has_any_frame and (loop_start - last_send_time) >= keepalive_interval:
|
||||
|
||||
Reference in New Issue
Block a user