mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-30 04:24:28 +02:00
add data from arp to host
This commit is contained in:
parent
8b9f63c7b7
commit
b0918fd782
1 changed files with 23 additions and 6 deletions
|
@ -770,12 +770,25 @@ class MikrotikControllerData:
|
|||
self.data["host"][uid] = {}
|
||||
self.data["host"][uid]["source"] = "dhcp"
|
||||
|
||||
for key, key_data in zip(
|
||||
["address", "mac-address", "interface"],
|
||||
["address", "mac-address", "interface"],
|
||||
):
|
||||
if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown":
|
||||
self.data["host"][uid][key] = vals[key_data]
|
||||
for key, key_data in zip(
|
||||
["address", "mac-address", "interface"],
|
||||
["address", "mac-address", "interface"],
|
||||
):
|
||||
if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown":
|
||||
self.data["host"][uid][key] = vals[key_data]
|
||||
|
||||
# Add hosts from ARP
|
||||
for uid, vals in self.data["arp"].items():
|
||||
if uid not in self.data["host"]:
|
||||
self.data["host"][uid] = {}
|
||||
self.data["host"][uid]["source"] = "arp"
|
||||
|
||||
for key, key_data in zip(
|
||||
["address", "mac-address", "interface"],
|
||||
["address", "mac-address", "interface"],
|
||||
):
|
||||
if key not in self.data["host"][uid] or self.data["host"][uid][key] == "unknown":
|
||||
self.data["host"][uid][key] = vals[key_data]
|
||||
|
||||
# Process hosts
|
||||
for uid, vals in self.data["host"].items():
|
||||
|
@ -814,3 +827,7 @@ class MikrotikControllerData:
|
|||
# Update last seen
|
||||
if self.data["host"][uid]["available"]:
|
||||
self.data["host"][uid]["last-seen"] = utcnow()
|
||||
|
||||
# TEMP DEBUG
|
||||
for uid, vals in self.data["host"].items():
|
||||
_LOGGER.warning("HOST %s: %s", uid, vals)
|
Loading…
Add table
Add a link
Reference in a new issue