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)