Add Mikrotik WifiWave2 (#89711)

* Add support for wifiwave2

* Add test for wifiwave2
This commit is contained in:
Cosmin Luță 2023-03-28 09:46:16 +03:00 committed by GitHub
parent b399e5c8b7
commit 8807878529
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 0 deletions

View file

@ -31,9 +31,11 @@ from .const import (
IDENTITY,
INFO,
IS_CAPSMAN,
IS_WIFIWAVE2,
IS_WIRELESS,
MIKROTIK_SERVICES,
NAME,
WIFIWAVE2,
WIRELESS,
)
from .device import Device
@ -57,6 +59,7 @@ class MikrotikData:
self.devices: dict[str, Device] = {}
self.support_capsman: bool = False
self.support_wireless: bool = False
self.support_wifiwave2: bool = False
self.hostname: str = ""
self.model: str = ""
self.firmware: str = ""
@ -97,6 +100,7 @@ class MikrotikData:
self.serial_number = self.get_info(ATTR_SERIAL_NUMBER)
self.support_capsman = bool(self.command(MIKROTIK_SERVICES[IS_CAPSMAN]))
self.support_wireless = bool(self.command(MIKROTIK_SERVICES[IS_WIRELESS]))
self.support_wifiwave2 = bool(self.command(MIKROTIK_SERVICES[IS_WIFIWAVE2]))
def get_list_from_interface(self, interface: str) -> dict[str, dict[str, Any]]:
"""Get devices from interface."""
@ -121,6 +125,9 @@ class MikrotikData:
elif self.support_wireless:
_LOGGER.debug("Hub supports wireless Interface")
device_list = wireless_devices = self.get_list_from_interface(WIRELESS)
elif self.support_wifiwave2:
_LOGGER.debug("Hub supports wifiwave2 Interface")
device_list = wireless_devices = self.get_list_from_interface(WIFIWAVE2)
if not device_list or self.force_dhcp:
device_list = self.all_devices