diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 9c94b51..41bc38b 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -2179,7 +2179,11 @@ async def async_process_host(self): 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 @@ async def async_process_host(self): ].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 @@ async def async_process_host(self): 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 @@ async def async_process_host(self): 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][