Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.62.1 #12047

Merged
merged 9 commits into from
Jan 30, 2018
Prev Previous commit
Next Next commit
Fix asuswrt AttributeError on neigh for unknown device (#11960)
  • Loading branch information
scop authored and balloob committed Jan 30, 2018
commit 9fed3acc90c9c4cd585069ccf21ab050cbc8d416
3 changes: 2 additions & 1 deletion homeassistant/components/device_tracker/asuswrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def _get_neigh(self, cur_devices):
for device in result:
if device['mac'] is not None:
mac = device['mac'].upper()
old_ip = cur_devices.get(mac, {}).ip or None
old_device = cur_devices.get(mac)
old_ip = old_device.ip if old_device else None
devices[mac] = Device(mac, device.get('ip', old_ip), None)
return devices

Expand Down
3 changes: 3 additions & 0 deletions tests/components/device_tracker/test_asuswrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ def test_get_neigh(self, mocked_ssh):
scanner = get_scanner(self.hass, VALID_CONFIG_ROUTER_SSH)
scanner.connection = mocked_ssh
self.assertEqual(NEIGH_DEVICES, scanner._get_neigh(ARP_DEVICES.copy()))
self.assertEqual(NEIGH_DEVICES, scanner._get_neigh({
'UN:KN:WN:DE:VI:CE': Device('UN:KN:WN:DE:VI:CE', None, None),
}))
mocked_ssh.run_command.return_value = ''
self.assertEqual({}, scanner._get_neigh(ARP_DEVICES.copy()))

Expand Down