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