mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-12 18:34:30 +02:00
Override name in DNS if DHCP comment exists #86
This commit is contained in:
parent
27f1b14ec4
commit
77acb4b9fe
1 changed files with 9 additions and 0 deletions
|
@ -1723,11 +1723,20 @@ class MikrotikControllerData:
|
||||||
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 (
|
||||||
|
uid in self.data["dhcp"]
|
||||||
|
and self.data["dhcp"][uid]["comment"] != ""
|
||||||
|
):
|
||||||
|
# Override name if DHCP comment exists
|
||||||
|
self.data["host"][uid]["host-name"] = self.data["dhcp"][
|
||||||
|
uid
|
||||||
|
]["comment"].split("#", 1)[0]
|
||||||
else:
|
else:
|
||||||
self.data["host"][uid]["host-name"] = dns_vals[
|
self.data["host"][uid]["host-name"] = dns_vals[
|
||||||
"name"
|
"name"
|
||||||
].split(".")[0]
|
].split(".")[0]
|
||||||
break
|
break
|
||||||
|
|
||||||
# Resolve hostname from DHCP comment
|
# Resolve hostname from DHCP comment
|
||||||
if (
|
if (
|
||||||
self.data["host"][uid]["host-name"] == "unknown"
|
self.data["host"][uid]["host-name"] == "unknown"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue