Skip to content

Commit 128b113

Browse files
authored
Merge pull request #83 from CoMPaTech/v6
Introduce basic v6 support: ## New Features - Adds AirOS 6 support (login/status), - Migrate towards a shared multi‑firmware base - Add a firmware-detection helper. ## Bug Fixes - Interfaces accept optional MTU; improved error handling and redacted logging of sensitive data.
2 parents 4909013 + ac7d97f commit 128b113

22 files changed

+2265
-499
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.5.1] - 2025-08-31
6+
7+
### Changed
8+
9+
- Created a base class based on AirOS8 for both v6 and v8 to consume increasing mypy options for consumption
10+
11+
## [0.5.0] - Not released
12+
13+
Initial support for firmware 6
14+
15+
### Added
16+
17+
- Add logging redacted data on interface [issue](https://github.com/home-assistant/core/issues/151348)
18+
- W.r.t. reported NanoBeam 8.7.18; Mark mtu optional on interfaces
19+
- W.r.t. reported NanoStation 6.3.16-22; Provide preliminary status reporting
20+
521
## [0.4.4] - 2025-08-29
622

723
### Changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ if __name__ == "__main__":
113113

114114
## Supported API classes and calls
115115

116+
Note: For firmware 6 we only support the login and status calls currently.
117+
116118
### Classes
117119

118120
- `airos.data` (directly) as well as `airos.airos8` (indirectly) provides `AirOSData`, a [mashumaro](https://pypi.org/project/mashumaro/) based dataclass

airos/airos6.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
"""Ubiquiti AirOS 6."""
2+
3+
from __future__ import annotations
4+
5+
import logging
6+
from typing import Any
7+
8+
from aiohttp import ClientSession
9+
10+
from .base import AirOS
11+
from .data import AirOS6Data, DerivedWirelessRole
12+
from .exceptions import AirOSNotSupportedError
13+
14+
_LOGGER = logging.getLogger(__name__)
15+
16+
17+
class AirOS6(AirOS[AirOS6Data]):
18+
"""AirOS 6 connection class."""
19+
20+
def __init__(
21+
self,
22+
host: str,
23+
username: str,
24+
password: str,
25+
session: ClientSession,
26+
use_ssl: bool = True,
27+
) -> None:
28+
"""Initialize AirOS8 class."""
29+
super().__init__(
30+
data_model=AirOS6Data,
31+
host=host,
32+
username=username,
33+
password=password,
34+
session=session,
35+
use_ssl=use_ssl,
36+
)
37+
38+
@staticmethod
39+
def derived_wireless_data(
40+
derived: dict[str, Any], response: dict[str, Any]
41+
) -> dict[str, Any]:
42+
"""Add derived wireless data to the device response."""
43+
# Access Point / Station - no info on ptp/ptmp
44+
# assuming ptp for station mode
45+
derived["ptp"] = True
46+
wireless_mode = response.get("wireless", {}).get("mode", "")
47+
match wireless_mode:
48+
case "ap":
49+
derived["access_point"] = True
50+
derived["role"] = DerivedWirelessRole.ACCESS_POINT
51+
case "sta":
52+
derived["station"] = True
53+
54+
return derived
55+
56+
async def update_check(self, force: bool = False) -> dict[str, Any]:
57+
"""Check for firmware updates. Not supported on AirOS6."""
58+
raise AirOSNotSupportedError("Firmware update check not supported on AirOS6.")
59+
60+
async def stakick(self, mac_address: str | None = None) -> bool:
61+
"""Kick a station off the AP. Not supported on AirOS6."""
62+
raise AirOSNotSupportedError("Station kick not supported on AirOS6.")
63+
64+
async def provmode(self, active: bool = False) -> bool:
65+
"""Enable/Disable provisioning mode. Not supported on AirOS6."""
66+
raise AirOSNotSupportedError("Provisioning mode not supported on AirOS6.")
67+
68+
async def warnings(self) -> dict[str, Any]:
69+
"""Get device warnings. Not supported on AirOS6."""
70+
raise AirOSNotSupportedError("Device warnings not supported on AirOS6.")
71+
72+
async def progress(self) -> dict[str, Any]:
73+
"""Get firmware progress. Not supported on AirOS6."""
74+
raise AirOSNotSupportedError("Firmware progress not supported on AirOS6.")
75+
76+
async def download(self) -> dict[str, Any]:
77+
"""Download the device firmware. Not supported on AirOS6."""
78+
raise AirOSNotSupportedError("Firmware download not supported on AirOS6.")
79+
80+
async def install(self) -> dict[str, Any]:
81+
"""Install a firmware update. Not supported on AirOS6."""
82+
raise AirOSNotSupportedError("Firmware install not supported on AirOS6.")

0 commit comments

Comments
 (0)