Fix OpenWrt hostapd client fetch
This commit is contained in:
@@ -282,17 +282,14 @@ async def get_openwrt_status(cfg: dict[str, Any]) -> str:
|
|||||||
ifnames = sorted({name for name in ifnames if name})
|
ifnames = sorted({name for name in ifnames if name})
|
||||||
if ifnames:
|
if ifnames:
|
||||||
for ifname in ifnames:
|
for ifname in ifnames:
|
||||||
cmd_clients = ssh_cmd + [
|
cmd_clients = ssh_cmd + ["ubus", "call", f"hostapd.{ifname}", "get_clients"]
|
||||||
"sh",
|
|
||||||
"-c",
|
|
||||||
f"ubus call hostapd.{ifname} get_clients 2>/dev/null || echo '{{}}'",
|
|
||||||
]
|
|
||||||
rc2, out2 = await run_cmd_full(cmd_clients, timeout=timeout_sec + 15)
|
rc2, out2 = await run_cmd_full(cmd_clients, timeout=timeout_sec + 15)
|
||||||
if rc2 == 124:
|
if rc2 == 124:
|
||||||
return f"⚠️ OpenWrt SSH error (wifi clients {ifname}): timeout"
|
return f"?? OpenWrt SSH error (wifi clients {ifname}): timeout"
|
||||||
payload = _safe_json_load(out2)
|
if rc2 == 0:
|
||||||
if payload:
|
payload = _safe_json_load(out2)
|
||||||
wifi_clients.extend(_parse_hostapd_clients(payload, ifname))
|
if payload:
|
||||||
|
wifi_clients.extend(_parse_hostapd_clients(payload, ifname))
|
||||||
|
|
||||||
if leases:
|
if leases:
|
||||||
leases_list = _extract_leases(leases)
|
leases_list = _extract_leases(leases)
|
||||||
|
|||||||
Reference in New Issue
Block a user