From 8cec8ae53ece8f45231404e25d1a1f572e9174cb Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 8 Feb 2026 03:23:35 +0300 Subject: [PATCH] Fix OpenWrt Wi-Fi client discovery --- services/openwrt.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/services/openwrt.py b/services/openwrt.py index 3013764..cee3da9 100644 --- a/services/openwrt.py +++ b/services/openwrt.py @@ -124,6 +124,16 @@ def _extract_ifnames(wireless: dict[str, Any]) -> list[str]: return ifnames +def _extract_hostapd_ifnames(raw: str) -> list[str]: + ifnames: list[str] = [] + for line in raw.splitlines(): + name = line.strip() + if not name or name == "hostapd": + continue + ifnames.append(name) + return ifnames + + def _safe_json_load(raw: str) -> Any | None: if not raw: return None @@ -263,6 +273,13 @@ async def get_openwrt_status(cfg: dict[str, Any]) -> str: wifi_clients = _extract_wifi_clients(wireless) ifnames = _extract_ifnames(wireless) + rc_l, out_l = await run_cmd_full( + ssh_cmd + ["sh", "-c", "ubus -S list | awk -F. '/^hostapd\\.phy/{print $2}'"], + timeout=timeout_sec + 15, + ) + if rc_l == 0 and out_l.strip(): + ifnames.extend(_extract_hostapd_ifnames(out_l)) + ifnames = sorted({name for name in ifnames if name}) if ifnames: for ifname in ifnames: cmd_clients = ssh_cmd + [