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
This commit is contained in:
Luar Roji authored and Pascal Vizeli committed 2017-06-20 12:16:56 +02:00
1 parent 1928da1fae
commit 04920fa0bf
1 file changed
+6 -1
@@ -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