mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-28 22:45:01 +02:00
fixed default values when tracking is disabled
This commit is contained in:
parent
70cdb93eb3
commit
a1a407ca3c
1 changed files with 31 additions and 14 deletions
|
@ -285,6 +285,7 @@ class MikrotikControllerData:
|
||||||
return
|
return
|
||||||
|
|
||||||
for uid, vals in self.data["host"].items():
|
for uid, vals in self.data["host"].items():
|
||||||
|
if not self.host_tracking_initialized:
|
||||||
# Add missing default values
|
# Add missing default values
|
||||||
for key, default in zip(
|
for key, default in zip(
|
||||||
[
|
[
|
||||||
|
@ -965,6 +966,22 @@ class MikrotikControllerData:
|
||||||
self.data["host"][uid]["mac-address"] = uid
|
self.data["host"][uid]["mac-address"] = uid
|
||||||
self.data["host"][uid]["host-name"] = self.data["host_hass"][uid]
|
self.data["host"][uid]["host-name"] = self.data["host_hass"][uid]
|
||||||
|
|
||||||
|
for uid, vals in self.data["host"].items():
|
||||||
|
# Add missing default values
|
||||||
|
for key, default in zip(
|
||||||
|
[
|
||||||
|
"address",
|
||||||
|
"mac-address",
|
||||||
|
"interface",
|
||||||
|
"host-name",
|
||||||
|
"last-seen",
|
||||||
|
"available",
|
||||||
|
],
|
||||||
|
["unknown", "unknown", "unknown", "unknown", False, False],
|
||||||
|
):
|
||||||
|
if key not in self.data["host"][uid]:
|
||||||
|
self.data["host"][uid][key] = default
|
||||||
|
|
||||||
if not self.host_tracking_initialized:
|
if not self.host_tracking_initialized:
|
||||||
await self.async_ping_tracked_hosts(utcnow())
|
await self.async_ping_tracked_hosts(utcnow())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue