net: app_network.py reflects WiFi swap — uplink on wlan0, AP on wlan1

This commit is contained in:
Mathieu Moran
2026-08-12 16:17:21 -04:00
parent 4827b73e68
commit b4b3643201
+9 -6
View File
@@ -9,8 +9,11 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
INSTALLED_HELPER = "/usr/local/bin/yaris-uplink" INSTALLED_HELPER = "/usr/local/bin/yaris-uplink"
REPO_HELPER = os.path.join(BASE_DIR, "deploy", "yaris_uplink.py") REPO_HELPER = os.path.join(BASE_DIR, "deploy", "yaris_uplink.py")
PHONE_CONNECTION = "phone-hotspot" PHONE_CONNECTION = "phone-hotspot"
PRIMARY_INTERFACE = "wlan1" # 2026-08-12 swap: onboard (wlan0) carries the internet uplink; the fast
FALLBACK_INTERFACE = "wlan0" # T3U (wlan1) hosts the in-car AP.
PRIMARY_INTERFACE = "wlan0"
FALLBACK_INTERFACE = "wlan1"
AP_INTERFACE = "wlan1"
STATUS_PATH = "/var/lib/yaris-obd/uplink-status.json" STATUS_PATH = "/var/lib/yaris-obd/uplink-status.json"
@@ -135,23 +138,23 @@ def get_status():
phone_ssid = _phone_ssid() phone_ssid = _phone_ssid()
internet_reachable = connectivity == "4 (full)" internet_reachable = connectivity == "4 (full)"
# Check wlan0 AP state (permanent hotspot) # Check AP state on wlan1 (T3U)
ap_active = False ap_active = False
ap_ip = "" ap_ip = ""
try: try:
ap_active = subprocess.run( ap_active = subprocess.run(
["nmcli", "-g", "GENERAL.CONNECTION", "device", "show", "wlan0"], ["nmcli", "-g", "GENERAL.CONNECTION", "device", "show", AP_INTERFACE],
capture_output=True, text=True, timeout=5, capture_output=True, text=True, timeout=5,
).stdout.strip() == "Hotspot-local" ).stdout.strip() == "Hotspot-local"
if ap_active: if ap_active:
ap_ip = subprocess.run( ap_ip = subprocess.run(
["nmcli", "-g", "IP4.ADDRESS", "device", "show", "wlan0"], ["nmcli", "-g", "IP4.ADDRESS", "device", "show", AP_INTERFACE],
capture_output=True, text=True, timeout=5, capture_output=True, text=True, timeout=5,
).stdout.strip().split("/", 1)[0] ).stdout.strip().split("/", 1)[0]
except (OSError, subprocess.SubprocessError): except (OSError, subprocess.SubprocessError):
pass pass
# Mode reflects wlan1 uplink state, not wlan0 AP # Mode reflects the uplink interface state, not the AP
uplink_mode = ( uplink_mode = (
"phone" if active == PHONE_CONNECTION "phone" if active == PHONE_CONNECTION
else "wifi" if active else "wifi" if active