-
Notifications
You must be signed in to change notification settings - Fork 1
Introduce basic v6 support #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
994c78e
Introduce basic v6 support
CoMPaTech 1ccab3a
Improve DRY and add unsupported errors
CoMPaTech 8fa8a25
Add CRAI suggestions
CoMPaTech aa10da7
MyPy
CoMPaTech b19f019
Add detection helper
CoMPaTech 9c2fb94
Bump release
CoMPaTech 202356a
Base class for mypy
CoMPaTech adc6cf7
Mypy
CoMPaTech 6ddf378
Mypy x2
CoMPaTech ac7d97f
Bump release
CoMPaTech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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.") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.