Fix Mikrotik rename from wifiwave2 to wifi for upcoming RouterOS 7.13 (#104966)

Co-authored-by: Marco98 <Marco98@users.noreply.github.com>
This commit is contained in:
Marco 2023-12-05 09:21:03 +01:00 committed by GitHub
parent 482e087a85
commit b7bc49b863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -31,10 +31,12 @@ from .const import (
IDENTITY,
INFO,
IS_CAPSMAN,
IS_WIFI,
IS_WIFIWAVE2,
IS_WIRELESS,
MIKROTIK_SERVICES,
NAME,
WIFI,
WIFIWAVE2,
WIRELESS,
)
@ -60,6 +62,7 @@ class MikrotikData:
self.support_capsman: bool = False
self.support_wireless: bool = False
self.support_wifiwave2: bool = False
self.support_wifi: bool = False
self.hostname: str = ""
self.model: str = ""
self.firmware: str = ""
@ -101,6 +104,7 @@ class MikrotikData:
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]))
self.support_wifi = bool(self.command(MIKROTIK_SERVICES[IS_WIFI]))
def get_list_from_interface(self, interface: str) -> dict[str, dict[str, Any]]:
"""Get devices from interface."""
@ -128,6 +132,9 @@ class MikrotikData:
elif self.support_wifiwave2:
_LOGGER.debug("Hub supports wifiwave2 Interface")
device_list = wireless_devices = self.get_list_from_interface(WIFIWAVE2)
elif self.support_wifi:
_LOGGER.debug("Hub supports wifi Interface")
device_list = wireless_devices = self.get_list_from_interface(WIFI)
if not device_list or self.force_dhcp:
device_list = self.all_devices