From e2b4ffca5dc62ef070fa0c9e060d45a7b76226e4 Mon Sep 17 00:00:00 2001 From: Luar Roji Date: Mon, 19 Jun 2017 15:24:50 -0300 Subject: [PATCH] Only mark active DHCP clients as present We only want to know which of the DHCP clients are indeed active. For example: I've a table of static DHCP leases with most of the IPs of my network, so this module is always detecting them as present. With my patch only the active ones will be detected as present. I already mentioned here: https://github.com/home-assistant/home-assistant/pull/7366#issuecomment-302950139 --- homeassistant/components/device_tracker/mikrotik.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/device_tracker/mikrotik.py b/homeassistant/components/device_tracker/mikrotik.py index af543548fbdec..fc1918f08cc02 100644 --- a/homeassistant/components/device_tracker/mikrotik.py +++ b/homeassistant/components/device_tracker/mikrotik.py @@ -158,6 +158,11 @@ def _update_info(self): for device in devices } else: - self.last_results = mac_names + self.last_results = { + device.get('mac-address'): + mac_names.get(device.get('mac-address')) + for device in device_names + if device.get('active-address') + } return True