From 242f8142d2366a74a56f6ff5e965c0ef9b2d96b5 Mon Sep 17 00:00:00 2001 From: Tomaae <23486452+tomaae@users.noreply.github.com> Date: Thu, 1 May 2025 14:36:34 +0200 Subject: [PATCH] Added dhcp client ip to interfaces, ref #321 --- custom_components/mikrotik_router/coordinator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/mikrotik_router/coordinator.py b/custom_components/mikrotik_router/coordinator.py index d98e219..60582ca 100644 --- a/custom_components/mikrotik_router/coordinator.py +++ b/custom_components/mikrotik_router/coordinator.py @@ -974,7 +974,12 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]): self.ds["interface"][uid]["client-mac-address"] = "multiple" if self.ds["interface"][uid]["client-ip-address"] == "": - self.ds["interface"][uid]["client-ip-address"] = "none" + if self.ds["interface"][uid]["name"] in self.ds["dhcp-client"]: + self.ds["interface"][uid]["client-ip-address"] = self.ds[ + "dhcp-client" + ][self.ds["interface"][uid]["name"]]["address"] + else: + self.ds["interface"][uid]["client-ip-address"] = "none" if self.ds["interface"][uid]["client-mac-address"] == "": self.ds["interface"][uid]["client-mac-address"] = "none" @@ -1968,6 +1973,7 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]): vals=[ {"name": "interface", "default": "unknown"}, {"name": "status", "default": "unknown"}, + {"name": "address", "default": "unknown"}, ], )