mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-10 09:24:31 +02:00
Fixed empty comments as tracker entity name (hash as first character) #130
This commit is contained in:
parent
40f95e95f2
commit
d9eaf47e10
1 changed files with 4 additions and 3 deletions
|
@ -1764,13 +1764,14 @@ class MikrotikControllerData:
|
||||||
if vals["address"] != "unknown":
|
if vals["address"] != "unknown":
|
||||||
for dns_uid, dns_vals in self.data["dns"].items():
|
for dns_uid, dns_vals in self.data["dns"].items():
|
||||||
if dns_vals["address"] == vals["address"]:
|
if dns_vals["address"] == vals["address"]:
|
||||||
if dns_vals["comment"] != "":
|
if dns_vals["comment"].split("#", 1)[0] != "":
|
||||||
self.data["host"][uid]["host-name"] = dns_vals[
|
self.data["host"][uid]["host-name"] = dns_vals[
|
||||||
"comment"
|
"comment"
|
||||||
].split("#", 1)[0]
|
].split("#", 1)[0]
|
||||||
elif (
|
elif (
|
||||||
uid in self.data["dhcp"]
|
uid in self.data["dhcp"]
|
||||||
and self.data["dhcp"][uid]["comment"] != ""
|
and self.data["dhcp"][uid]["comment"].split("#", 1)[0]
|
||||||
|
!= ""
|
||||||
):
|
):
|
||||||
# Override name if DHCP comment exists
|
# Override name if DHCP comment exists
|
||||||
self.data["host"][uid]["host-name"] = self.data["dhcp"][
|
self.data["host"][uid]["host-name"] = self.data["dhcp"][
|
||||||
|
@ -1786,7 +1787,7 @@ class MikrotikControllerData:
|
||||||
if (
|
if (
|
||||||
self.data["host"][uid]["host-name"] == "unknown"
|
self.data["host"][uid]["host-name"] == "unknown"
|
||||||
and uid in self.data["dhcp"]
|
and uid in self.data["dhcp"]
|
||||||
and self.data["dhcp"][uid]["comment"] != ""
|
and self.data["dhcp"][uid]["comment"].split("#", 1)[0] != ""
|
||||||
):
|
):
|
||||||
self.data["host"][uid]["host-name"] = self.data["dhcp"][uid][
|
self.data["host"][uid]["host-name"] = self.data["dhcp"][uid][
|
||||||
"comment"
|
"comment"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue