Fix get_device_name and get_actiontec_data

This commit is contained in:
Nolan Gilley 2015-08-25 09:39:00 -04:00
parent 93bd238be5
commit 047b4abd82

View File

@ -95,8 +95,8 @@ class ActiontecDeviceScanner(object):
if not self.last_results: if not self.last_results:
return None return None
for client in self.last_results: for client in self.last_results:
if client == device: if client['mac'] == device:
return client return client['ip']
return None return None
@Throttle(MIN_TIME_BETWEEN_SCANS) @Throttle(MIN_TIME_BETWEEN_SCANS)
@ -130,14 +130,13 @@ class ActiontecDeviceScanner(object):
telnet.read_until(prompt) telnet.read_until(prompt)
leases_result = telnet.read_until(prompt).split(b'\n')[1:-1] leases_result = telnet.read_until(prompt).split(b'\n')[1:-1]
telnet.write('exit\n'.encode('ascii')) telnet.write('exit\n'.encode('ascii'))
return None
except EOFError: except EOFError:
_LOGGER.exception("Unexpected response from router") _LOGGER.exception("Unexpected response from router")
return return
except ConnectionRefusedError: except ConnectionRefusedError:
_LOGGER.exception("Connection refused by router," + _LOGGER.exception("Connection refused by router," +
" is telnet enabled?") " is telnet enabled?")
return return None
devices = {} devices = {}
for lease in leases_result: for lease in leases_result: