From 95aeee53ee7f762390dd7207a9e4abcfde124fa8 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Mon, 28 Jul 2025 11:29:09 +0200 Subject: [PATCH 1/2] Add unms status and sta_disconnected --- airos/data.py | 36 ++++++++++++++++++++++++++---------- pyproject.toml | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/airos/data.py b/airos/data.py index dab8c5d..c6e8545 100644 --- a/airos/data.py +++ b/airos/data.py @@ -208,6 +208,14 @@ class GPSData: fix: int +@dataclass +class UnmsStatus: + """Leaf definition.""" + + status: int + timestamp: str + + @dataclass class Remote: """Leaf definition.""" @@ -248,7 +256,7 @@ class Remote: ip6addr: list[str] gps: GPSData oob: bool - unms: dict[str, Any] + unms: UnmsStatus airview: int service: ServiceTime @@ -259,9 +267,23 @@ def __pre_deserialize__(cls, d: dict[str, Any]) -> dict[str, Any]: return d +@dataclass +class Disconnected: + """Leaf definition for disconnected devices.""" + + mac: str + lastip: str + signal: int + hostname: str + platform: str + reason_code: int + disconnect_duration: int + airos_connected: bool = False # Mock add to determine Disconnected vs Station + + @dataclass class Station: - """Leaf definition.""" + """Leaf definition for connected/active devices.""" mac: str lastip: str @@ -295,6 +317,7 @@ class Station: airmax: Airmax last_disc: int remote: Remote + airos_connected: bool = True # Mock add to determine Disconnected vs Station @dataclass @@ -334,7 +357,7 @@ class Wireless: polling: Polling count: int sta: list[Station] - sta_disconnected: list[Any] + sta_disconnected: list[Disconnected] @classmethod def __pre_deserialize__(cls, d: dict[str, Any]) -> dict[str, Any]: @@ -395,13 +418,6 @@ class NtpClient: pass -@dataclass -class UnmsStatus: - """Leaf definition.""" - - status: int - - @dataclass class GPSMain: """Leaf definition.""" diff --git a/pyproject.toml b/pyproject.toml index 4dbd227..e8b92d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "airos" -version = "0.1.7" +version = "0.1.8" license = "MIT" description = "Ubiquity airOS module(s) for Python 3." readme = "README.md" From 3115b79b52905fb556e29d7b4eaabbf5730edc2a Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Mon, 28 Jul 2025 11:39:42 +0200 Subject: [PATCH 2/2] Ensure devices without UNMS/UISP are ok --- airos/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airos/data.py b/airos/data.py index c6e8545..0dc69a5 100644 --- a/airos/data.py +++ b/airos/data.py @@ -213,7 +213,7 @@ class UnmsStatus: """Leaf definition.""" status: int - timestamp: str + timestamp: str | None = None @dataclass