diff --git a/carwatch/webchat.py b/carwatch/webchat.py index c19a559..68d8fcd 100644 --- a/carwatch/webchat.py +++ b/carwatch/webchat.py @@ -110,7 +110,7 @@ def _switch_later(name: str) -> None: It reads Home Assistant at home. You never type a Mercedes password here.
    -
  1. On home wifi open Home Assistant (http://192.168.50.241:8123)
  2. +
  3. On home wifi open Home Assistant (__HA_URL__)
  4. Tap your name, then Security, then Create long-lived access token
  5. Copy the token and paste it below, then tap Connect
@@ -2965,7 +2965,10 @@ def run(cmd): # Minimal setup + status page for the cloud provider: email -> # vendor emails a one-time code -> code -> tokens on the Pi. # The owner's PASSWORD is never asked anywhere on this page. - return self._send(200, CLOUDCAR_PAGE) + # The HA address comes from config (ha.url), not from source. + from html import escape + from carwatch import mercedesme as _mm + return self._send(200, CLOUDCAR_PAGE.replace("__HA_URL__", escape(_mm._ha_url()))) elif self.path.startswith("/streams"): return self._send(200, STREAMS_PAGE) elif self.path.startswith("/nerd"): diff --git a/tests/test_preflight.py b/tests/test_preflight.py index fc77960..41d1948 100644 --- a/tests/test_preflight.py +++ b/tests/test_preflight.py @@ -29,7 +29,7 @@ def setUp(self): ("tailscale", "ip", "-4"): "100.65.0.9", ("bluetoothctl", "info", "AA:BB:CC:DD:EE:FF"): "Device AA:BB:CC:DD:EE:FF\n\tPaired: yes\n\tTrusted: yes", } - self.http = {pf.INTERNET_PROBE: 204, "http://100.97.140.13:8123/api/": 401} + self.http = {pf.INTERNET_PROBE: 204, "http://100.64.0.10:8123/api/": 401} self._patches = [ mock.patch.object(pf, "_run", lambda cmd, timeout=5.0, any_rc=False: self.runs.get(tuple(cmd))), mock.patch.object(pf, "_http_status", lambda url, timeout=4.0: self.http.get(url)), @@ -37,7 +37,7 @@ def setUp(self): mock.patch("carwatch.brain.model_url", lambda now=None: "http://127.0.0.1:8080/v1/chat/completions"), mock.patch("carwatch.brain._healthy", lambda url, timeout=2.0: True), mock.patch.object(pf, "_local_state", lambda: "down"), - mock.patch("carwatch.mercedesme._ha_url", lambda: "http://100.97.140.13:8123"), + mock.patch("carwatch.mercedesme._ha_url", lambda: "http://100.64.0.10:8123"), mock.patch("carwatch.mercedesme._TOKEN_FILE", os.path.join(self.tmp, "ha-token")), mock.patch.object(pf, "_adapter_present", lambda: None), mock.patch.object(pf, "_obd_mac", lambda: "AA:BB:CC:DD:EE:FF"), @@ -86,7 +86,7 @@ def test_all_ready(self): def test_mercedes_names_missing_token_and_unreachable_ha(self): os.remove(os.path.join(self.tmp, "ha-token")) - self.http.pop("http://100.97.140.13:8123/api/") + self.http.pop("http://100.64.0.10:8123/api/") self.runs.pop(("tailscale", "ip", "-4")) res = pf.run() t = self._tile(res, "mercedes")