watt42 url, ensure we default to prod and can configure via env var
This commit is contained in:
parent
cc7ee0817e
commit
9fc66e9e27
1 changed files with 4 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import panel
|
import panel
|
||||||
|
|
||||||
from websockets import ConnectionClosed
|
from websockets import ConnectionClosed
|
||||||
|
|
@ -8,9 +9,11 @@ from websockets.asyncio.client import connect
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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):
|
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
|
must_reconnect = True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue