mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-25 18:28:46 +02:00
Do not update IP or hostname from disabled DHCP entry #265
This commit is contained in:
parent
a7c00d8fb3
commit
ce9ce906f5
1 changed files with 8 additions and 1 deletions
|
@ -2179,7 +2179,11 @@ class MikrotikControllerData:
|
|||
self.data["host"][uid]["available"] = False
|
||||
|
||||
# Update IP and interface (DHCP/returned host)
|
||||
if uid in self.data["dhcp"] and "." in self.data["dhcp"][uid]["address"]:
|
||||
if (
|
||||
uid in self.data["dhcp"]
|
||||
and self.data["dhcp"][uid]["enabled"]
|
||||
and "." in self.data["dhcp"][uid]["address"]
|
||||
):
|
||||
if (
|
||||
self.data["dhcp"][uid]["address"]
|
||||
!= self.data["host"][uid]["address"]
|
||||
|
@ -2217,6 +2221,7 @@ class MikrotikControllerData:
|
|||
].split("#", 1)[0]
|
||||
elif (
|
||||
uid in self.data["dhcp"]
|
||||
and self.data["dhcp"][uid]["enabled"]
|
||||
and self.data["dhcp"][uid]["comment"].split("#", 1)[0]
|
||||
!= ""
|
||||
):
|
||||
|
@ -2234,6 +2239,7 @@ class MikrotikControllerData:
|
|||
if (
|
||||
self.data["host"][uid]["host-name"] == "unknown"
|
||||
and uid in self.data["dhcp"]
|
||||
and self.data["dhcp"][uid]["enabled"]
|
||||
and self.data["dhcp"][uid]["comment"].split("#", 1)[0] != ""
|
||||
):
|
||||
self.data["host"][uid]["host-name"] = self.data["dhcp"][uid][
|
||||
|
@ -2243,6 +2249,7 @@ class MikrotikControllerData:
|
|||
elif (
|
||||
self.data["host"][uid]["host-name"] == "unknown"
|
||||
and uid in self.data["dhcp"]
|
||||
and self.data["dhcp"][uid]["enabled"]
|
||||
and self.data["dhcp"][uid]["host-name"] != "unknown"
|
||||
):
|
||||
self.data["host"][uid]["host-name"] = self.data["dhcp"][uid][
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue