mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-03 14:04:28 +02:00
fixed crash on wireless recovery #24
This commit is contained in:
parent
4473a3cb4c
commit
cd41d0c50f
1 changed files with 9 additions and 9 deletions
|
@ -852,9 +852,9 @@ class MikrotikControllerData:
|
||||||
key="mac-address",
|
key="mac-address",
|
||||||
vals=[
|
vals=[
|
||||||
{"name": "mac-address"},
|
{"name": "mac-address"},
|
||||||
|
{"name": "address", "default": "unknown"},
|
||||||
{"name": "interface", "default": "unknown"},
|
{"name": "interface", "default": "unknown"},
|
||||||
{"name": "radio-name", "default": "unknown"},
|
{"name": "ap", "type": "bool"},
|
||||||
{"name": "ap", "default": "no"},
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -888,8 +888,8 @@ class MikrotikControllerData:
|
||||||
["mac-address", "interface"],
|
["mac-address", "interface"],
|
||||||
["mac-address", "interface"],
|
["mac-address", "interface"],
|
||||||
):
|
):
|
||||||
if key not in self.data["host"][uid] or self.data["capsman_hosts"][uid][key] == "unknown":
|
if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown":
|
||||||
self.data["capsman_hosts"][uid][key] = vals[key_data]
|
self.data["host"][uid][key] = vals[key_data]
|
||||||
|
|
||||||
# Update last seen
|
# Update last seen
|
||||||
capsman_detected[uid] = True
|
capsman_detected[uid] = True
|
||||||
|
@ -900,7 +900,7 @@ class MikrotikControllerData:
|
||||||
if self.support_wireless:
|
if self.support_wireless:
|
||||||
wireless_detected = {}
|
wireless_detected = {}
|
||||||
for uid, vals in self.data["wireless_hosts"].items():
|
for uid, vals in self.data["wireless_hosts"].items():
|
||||||
if vals["ap"] == "yes":
|
if vals["ap"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if uid not in self.data["host"]:
|
if uid not in self.data["host"]:
|
||||||
|
@ -908,11 +908,11 @@ class MikrotikControllerData:
|
||||||
|
|
||||||
self.data["host"][uid]["source"] = "wireless"
|
self.data["host"][uid]["source"] = "wireless"
|
||||||
for key, key_data in zip(
|
for key, key_data in zip(
|
||||||
["mac-address", "interface"],
|
["mac-address", "address", "interface"],
|
||||||
["mac-address", "interface"],
|
["mac-address", "address", "interface"],
|
||||||
):
|
):
|
||||||
if key not in self.data["host"][uid] or self.data["wireless_hosts"][uid][key] == "unknown":
|
if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown":
|
||||||
self.data["wireless_hosts"][uid][key] = vals[key_data]
|
self.data["host"][uid][key] = vals[key_data]
|
||||||
|
|
||||||
# Update last seen
|
# Update last seen
|
||||||
wireless_detected[uid] = True
|
wireless_detected[uid] = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue