From cd41d0c50f9413b207ea3b0b44bdd408e14cc369 Mon Sep 17 00:00:00 2001 From: tomaae <23486452+tomaae@users.noreply.github.com> Date: Fri, 10 Apr 2020 01:21:20 +0200 Subject: [PATCH] fixed crash on wireless recovery #24 --- .../mikrotik_router/mikrotik_controller.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 02d953e..74c1476 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -852,9 +852,9 @@ class MikrotikControllerData: key="mac-address", vals=[ {"name": "mac-address"}, + {"name": "address", "default": "unknown"}, {"name": "interface", "default": "unknown"}, - {"name": "radio-name", "default": "unknown"}, - {"name": "ap", "default": "no"}, + {"name": "ap", "type": "bool"}, ] ) @@ -888,8 +888,8 @@ class MikrotikControllerData: ["mac-address", "interface"], ["mac-address", "interface"], ): - if key not in self.data["host"][uid] or self.data["capsman_hosts"][uid][key] == "unknown": - self.data["capsman_hosts"][uid][key] = vals[key_data] + if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown": + self.data["host"][uid][key] = vals[key_data] # Update last seen capsman_detected[uid] = True @@ -900,7 +900,7 @@ class MikrotikControllerData: if self.support_wireless: wireless_detected = {} for uid, vals in self.data["wireless_hosts"].items(): - if vals["ap"] == "yes": + if vals["ap"]: continue if uid not in self.data["host"]: @@ -908,11 +908,11 @@ class MikrotikControllerData: self.data["host"][uid]["source"] = "wireless" for key, key_data in zip( - ["mac-address", "interface"], - ["mac-address", "interface"], + ["mac-address", "address", "interface"], + ["mac-address", "address", "interface"], ): - if key not in self.data["host"][uid] or self.data["wireless_hosts"][uid][key] == "unknown": - self.data["wireless_hosts"][uid][key] = vals[key_data] + if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown": + self.data["host"][uid][key] = vals[key_data] # Update last seen wireless_detected[uid] = True