mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-22 19:54:23 +02:00
fixed dictionary changed size during iteration for async_ping_tracked_hosts
This commit is contained in:
parent
a1a407ca3c
commit
d189ad8c66
1 changed files with 7 additions and 5 deletions
|
@ -284,7 +284,7 @@ class MikrotikControllerData:
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
for uid, vals in self.data["host"].items():
|
for uid in list(self.data["host"]):
|
||||||
if not self.host_tracking_initialized:
|
if not self.host_tracking_initialized:
|
||||||
# Add missing default values
|
# Add missing default values
|
||||||
for key, default in zip(
|
for key, default in zip(
|
||||||
|
@ -303,14 +303,16 @@ class MikrotikControllerData:
|
||||||
|
|
||||||
# Check host availability
|
# Check host availability
|
||||||
if (
|
if (
|
||||||
vals["source"] not in ["capsman", "wireless"]
|
self.data["host"][uid]["source"] not in ["capsman", "wireless"]
|
||||||
and vals["address"] != "unknown"
|
and self.data["host"][uid]["address"] != "unknown"
|
||||||
and vals["interface"] != "unknown"
|
and self.data["host"][uid]["interface"] != "unknown"
|
||||||
):
|
):
|
||||||
self.data["host"][uid][
|
self.data["host"][uid][
|
||||||
"available"
|
"available"
|
||||||
] = await self.hass.async_add_executor_job(
|
] = await self.hass.async_add_executor_job(
|
||||||
self.api_ping.arp_ping, vals["address"], vals["interface"]
|
self.api_ping.arp_ping,
|
||||||
|
self.data["host"][uid]["address"],
|
||||||
|
self.data["host"][uid]["interface"]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update last seen
|
# Update last seen
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue