From 04920fa0bf7a8936a409e268a35fe1185a93aa31 Mon Sep 17 00:00:00 2001 From: Luar Roji Date: Tue, 20 Jun 2017 07:16:56 -0300 Subject: [PATCH] Only mark active DHCP clients as present (#8110) 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 af543548fbd..fc1918f08cc 100644 --- a/homeassistant/components/device_tracker/mikrotik.py +++ b/homeassistant/components/device_tracker/mikrotik.py @@ -158,6 +158,11 @@ class MikrotikScanner(DeviceScanner): 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