feat: HA value source test — raw value axis + behavior IconSelect
Lint & Test / test (push) Successful in 1m9s
Lint & Test / test (push) Successful in 1m9s
- WS sends raw_value and raw_range for HA entity streams - Canvas draws right-side Y-axis labels: configured min/max range and current raw HA value (green, positioned at correct Y) - Replace plain <select> for scene behavior with IconSelect (moon/sun)
This commit is contained in:
@@ -384,7 +384,13 @@ async def test_value_source_ws(
|
||||
try:
|
||||
while True:
|
||||
value = stream.get_value()
|
||||
await websocket.send_json({"value": round(value, 4)})
|
||||
msg: dict = {"value": round(value, 4)}
|
||||
if hasattr(stream, "get_raw_value"):
|
||||
raw = stream.get_raw_value()
|
||||
if raw is not None:
|
||||
msg["raw_value"] = round(raw, 4)
|
||||
msg["raw_range"] = [stream._min_ha, stream._max_ha]
|
||||
await websocket.send_json(msg)
|
||||
await asyncio.sleep(0.05)
|
||||
except WebSocketDisconnect:
|
||||
logger.debug("Value source test WebSocket disconnected for %s", source_id)
|
||||
|
||||
Reference in New Issue
Block a user