mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-28 03:30:07 +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":
|
||||
for dns_uid, dns_vals in self.data["dns"].items():
|
||||
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[
|
||||
"comment"
|
||||
].split("#", 1)[0]
|
||||
elif (
|
||||
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
|
||||
self.data["host"][uid]["host-name"] = self.data["dhcp"][
|
||||
|
@ -1786,7 +1787,7 @@ class MikrotikControllerData:
|
|||
if (
|
||||
self.data["host"][uid]["host-name"] == "unknown"
|
||||
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][
|
||||
"comment"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue