WS now sends color RGB data for color-type streams. Test modal renders a color history swatch strip below the chart, colors the chart line and fill area with the current output color, and shows rgb() in the stats. Works for static_color, animated_color, and adaptive_time_color sources.
This commit is contained in:
@@ -47,6 +47,7 @@ from wled_controller.storage.value_source import (
|
||||
from wled_controller.storage.value_source_store import ValueSourceStore
|
||||
from wled_controller.storage.output_target_store import OutputTargetStore
|
||||
from wled_controller.core.processing.processor_manager import ProcessorManager
|
||||
from wled_controller.core.processing.value_stream import ValueStream
|
||||
from wled_controller.utils import get_logger
|
||||
from wled_controller.storage.base_store import EntityNotFoundError
|
||||
|
||||
@@ -381,10 +382,21 @@ async def test_value_source_ws(
|
||||
await websocket.accept()
|
||||
logger.info(f"Value source test WebSocket connected for {source_id}")
|
||||
|
||||
# Detect if this stream produces colors
|
||||
_is_color_stream = (
|
||||
hasattr(stream, "get_color") and type(stream).get_color is not ValueStream.get_color
|
||||
)
|
||||
|
||||
try:
|
||||
while True:
|
||||
value = stream.get_value()
|
||||
msg: dict = {"value": round(value, 4)}
|
||||
if _is_color_stream:
|
||||
try:
|
||||
r, g, b = stream.get_color()
|
||||
msg["color"] = [int(r), int(g), int(b)]
|
||||
except NotImplementedError:
|
||||
pass
|
||||
if hasattr(stream, "get_raw_value"):
|
||||
raw = stream.get_raw_value()
|
||||
if raw is not None:
|
||||
|
||||
Reference in New Issue
Block a user