watt42 url, ensure we default to prod and can configure via env var

This commit is contained in:
Chris Oloff 2026-01-07 14:06:11 +02:00
parent cc7ee0817e
commit 9fc66e9e27

View file

@ -1,6 +1,7 @@
import asyncio
import json
import logging
import os
import panel
from websockets import ConnectionClosed
@ -8,9 +9,11 @@ from websockets.asyncio.client import connect
logger = logging.getLogger(__name__)
default_ws_url = "wss://service.watt42.com/ws/systems"
def attach_w42_state(rx_var: panel.rx, system_id: str, token: str):
WS_URL = "ws://localhost:8000/ws/systems" # TODO: make configurable
WS_URL = os.environ.get("WATT42_WS_URL", default_ws_url)
must_reconnect = True