From 833b49a1d1b99176e3ce27588ab9c8747b701810 Mon Sep 17 00:00:00 2001 From: ms264556 <29752086+ms264556@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:37:39 +1200 Subject: [PATCH] Minimum SZ Home Assistant Compat --- aioruckus/smartzoneajaxapi.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/aioruckus/smartzoneajaxapi.py b/aioruckus/smartzoneajaxapi.py index c383add..564e973 100644 --- a/aioruckus/smartzoneajaxapi.py +++ b/aioruckus/smartzoneajaxapi.py @@ -21,8 +21,12 @@ def __init__(self, session: AjaxSession): async def get_aps(self) -> List[dict]: """Return a list of APs""" - ap_ids = await self.session.sz_get("aps") - return ap_ids + aps = await self.session.sz_query("ap") + compat_aps = [ + {**ap, "mac": ap["apMac"], "devname": ap["deviceName"], "version": ap["firmwareVersion"]} + for ap in aps + ] + return compat_aps async def get_ap_groups(self) -> List: """Return a list of AP groups""" @@ -83,11 +87,12 @@ async def get_dpsks(self) -> list[Dpsk | dict]: async def get_system_info(self, *sections: SystemStat) -> dict: """Return system information""" cluster_info = await self.__get_cluster_state() + cluster_info["name"] = cluster_info["clusterName"] current_controller_id = cluster_info["currentNodeId"] controllers = (await self.session.sz_get("controller"))["list"] sysinfo = next((controller for controller in controllers if controller["id"] == current_controller_id), controllers[0]) sysinfo["serial"] = sysinfo["serialNumber"] - return { "sysinfo": sysinfo } + return { "sysinfo": sysinfo, "identity": cluster_info } async def get_mesh_info(self) -> dict: """Return dummy mesh information"""