Fix OpenWrt hostapd client fetch

This commit is contained in:
2026-02-08 03:27:55 +03:00
parent 8cec8ae53e
commit 01c539fad9

View File

@@ -282,14 +282,11 @@ 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"
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))