mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-10 09:24:31 +02:00
renamed current arp datapoint to arp_tmp
This commit is contained in:
parent
004fc56269
commit
d568a7ca13
1 changed files with 22 additions and 21 deletions
|
@ -55,6 +55,7 @@ class MikrotikControllerData:
|
||||||
"resource": {},
|
"resource": {},
|
||||||
"interface": {},
|
"interface": {},
|
||||||
"arp": {},
|
"arp": {},
|
||||||
|
"arp_tmp": {},
|
||||||
"nat": {},
|
"nat": {},
|
||||||
"fw-update": {},
|
"fw-update": {},
|
||||||
"script": {},
|
"script": {},
|
||||||
|
@ -311,7 +312,7 @@ class MikrotikControllerData:
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
def get_interface_client(self):
|
def get_interface_client(self):
|
||||||
"""Get ARP data from Mikrotik"""
|
"""Get ARP data from Mikrotik"""
|
||||||
self.data["arp"] = {}
|
self.data["arp_tmp"] = {}
|
||||||
|
|
||||||
# Remove data if disabled
|
# Remove data if disabled
|
||||||
if not self.option_track_arp:
|
if not self.option_track_arp:
|
||||||
|
@ -329,14 +330,14 @@ class MikrotikControllerData:
|
||||||
|
|
||||||
# Map ARP to ifaces
|
# Map ARP to ifaces
|
||||||
for uid in self.data["interface"]:
|
for uid in self.data["interface"]:
|
||||||
if uid not in self.data["arp"]:
|
if uid not in self.data["arp_tmp"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.data["interface"][uid]["client-ip-address"] = from_entry(
|
self.data["interface"][uid]["client-ip-address"] = from_entry(
|
||||||
self.data["arp"][uid], "address"
|
self.data["arp_tmp"][uid], "address"
|
||||||
)
|
)
|
||||||
self.data["interface"][uid]["client-mac-address"] = from_entry(
|
self.data["interface"][uid]["client-mac-address"] = from_entry(
|
||||||
self.data["arp"][uid], "mac-address"
|
self.data["arp_tmp"][uid], "mac-address"
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
@ -372,16 +373,16 @@ class MikrotikControllerData:
|
||||||
|
|
||||||
_LOGGER.debug("Processing entry %s, entry %s", "/ip/arp", entry)
|
_LOGGER.debug("Processing entry %s, entry %s", "/ip/arp", entry)
|
||||||
# Create uid arp dict
|
# Create uid arp dict
|
||||||
if uid not in self.data["arp"]:
|
if uid not in self.data["arp_tmp"]:
|
||||||
self.data["arp"][uid] = {}
|
self.data["arp_tmp"][uid] = {}
|
||||||
|
|
||||||
# Add data
|
# Add data
|
||||||
self.data["arp"][uid]["interface"] = uid
|
self.data["arp_tmp"][uid]["interface"] = uid
|
||||||
self.data["arp"][uid]["mac-address"] = (
|
self.data["arp_tmp"][uid]["mac-address"] = (
|
||||||
from_entry(entry, "mac-address") if "mac-address" not in self.data["arp"][uid] else "multiple"
|
from_entry(entry, "mac-address") if "mac-address" not in self.data["arp_tmp"][uid] else "multiple"
|
||||||
)
|
)
|
||||||
self.data["arp"][uid]["address"] = (
|
self.data["arp_tmp"][uid]["address"] = (
|
||||||
from_entry(entry, "address") if "address" not in self.data["arp"][uid] else "multiple"
|
from_entry(entry, "address") if "address" not in self.data["arp_tmp"][uid] else "multiple"
|
||||||
)
|
)
|
||||||
|
|
||||||
return mac2ip, bridge_used
|
return mac2ip, bridge_used
|
||||||
|
@ -409,20 +410,20 @@ class MikrotikControllerData:
|
||||||
"Processing entry %s, entry %s", "/interface/bridge/host", entry
|
"Processing entry %s, entry %s", "/interface/bridge/host", entry
|
||||||
)
|
)
|
||||||
# Create uid arp dict
|
# Create uid arp dict
|
||||||
if uid not in self.data["arp"]:
|
if uid not in self.data["arp_tmp"]:
|
||||||
self.data["arp"][uid] = {}
|
self.data["arp_tmp"][uid] = {}
|
||||||
|
|
||||||
# Add data
|
# Add data
|
||||||
self.data["arp"][uid]["interface"] = uid
|
self.data["arp_tmp"][uid]["interface"] = uid
|
||||||
if "mac-address" in self.data["arp"][uid]:
|
if "mac-address" in self.data["arp_tmp"][uid]:
|
||||||
self.data["arp"][uid]["mac-address"] = "multiple"
|
self.data["arp_tmp"][uid]["mac-address"] = "multiple"
|
||||||
self.data["arp"][uid]["address"] = "multiple"
|
self.data["arp_tmp"][uid]["address"] = "multiple"
|
||||||
else:
|
else:
|
||||||
self.data["arp"][uid]["mac-address"] = from_entry(entry,
|
self.data["arp_tmp"][uid]["mac-address"] = from_entry(entry,
|
||||||
"mac-address")
|
"mac-address")
|
||||||
self.data["arp"][uid]["address"] = (
|
self.data["arp_tmp"][uid]["address"] = (
|
||||||
mac2ip[self.data["arp"][uid]["mac-address"]]
|
mac2ip[self.data["arp_tmp"][uid]["mac-address"]]
|
||||||
if self.data["arp"][uid]["mac-address"] in mac2ip
|
if self.data["arp_tmp"][uid]["mac-address"] in mac2ip
|
||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue