From 42e53f24555d2861bbb50a60f8aac6adf4dcca62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Pe=C5=A1ek=20=28Kof=29?= Date: Thu, 5 Nov 2026 23:04:28 +0100 Subject: [PATCH] feat(cast-tesla): update gxbox default to 192.168.1.107 with dynamic local IP routing --- cast-tesla | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cast-tesla b/cast-tesla index 892b135..3216bda 100755 --- a/cast-tesla +++ b/cast-tesla @@ -9,10 +9,22 @@ import http.server import threading import time -RENDERER_IP = "10.0.0.11" -RENDERER_PORT = 54321 -LOCAL_IP = "10.0.0.1" +RENDERER_IP = os.environ.get("RENDERER_IP", "192.168.1.107") +RENDERER_PORT = int(os.environ.get("RENDERER_PORT", "54321")) LOCAL_STREAM_PORT = 8201 + +def get_local_ip(target_ip): + try: + import socket + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.connect((target_ip, 80)) + ip = s.getsockname()[0] + s.close() + return ip + except Exception: + return "192.168.1.100" + +LOCAL_IP = get_local_ip(RENDERER_IP) CONTROL_URL = f"http://{RENDERER_IP}:{RENDERER_PORT}/_urn:schemas-upnp-org:service:AVTransport_control" def send_soap(action, body_xml):