From 9fc66e9e2786e07a7116bb63bcc5549cfffc5b4c Mon Sep 17 00:00:00 2001 From: Chris Oloff Date: Wed, 7 Jan 2026 14:06:11 +0200 Subject: [PATCH] watt42 url, ensure we default to prod and can configure via env var --- watt42_viewlib/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/watt42_viewlib/__init__.py b/watt42_viewlib/__init__.py index 7f733d0..ca8dd0d 100644 --- a/watt42_viewlib/__init__.py +++ b/watt42_viewlib/__init__.py @@ -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