From 01c539fad91c5df874308b6ad0613beeab3bf7c0 Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 8 Feb 2026 03:27:55 +0300 Subject: [PATCH] Fix OpenWrt hostapd client fetch --- services/openwrt.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/services/openwrt.py b/services/openwrt.py index cee3da9..31f8d52 100644 --- a/services/openwrt.py +++ b/services/openwrt.py @@ -282,17 +282,14 @@ async def get_openwrt_status(cfg: dict[str, Any]) -> str: ifnames = sorted({name for name in ifnames if name}) if ifnames: for ifname in ifnames: - cmd_clients = ssh_cmd + [ - "sh", - "-c", - f"ubus call hostapd.{ifname} get_clients 2>/dev/null || echo '{{}}'", - ] + cmd_clients = ssh_cmd + ["ubus", "call", f"hostapd.{ifname}", "get_clients"] rc2, out2 = await run_cmd_full(cmd_clients, timeout=timeout_sec + 15) if rc2 == 124: - return f"⚠️ OpenWrt SSH error (wifi clients {ifname}): timeout" - payload = _safe_json_load(out2) - if payload: - wifi_clients.extend(_parse_hostapd_clients(payload, ifname)) + return f"?? OpenWrt SSH error (wifi clients {ifname}): timeout" + if rc2 == 0: + payload = _safe_json_load(out2) + if payload: + wifi_clients.extend(_parse_hostapd_clients(payload, ifname)) if leases: leases_list = _extract_leases(leases)