Merge pull request #614 from persandstrom/asuswrt_not_loading

ASUSWRT more logging and more robust
This commit is contained in:
Paulus Schoutsen 2015-11-12 11:43:49 -08:00
commit 16904452b8

View File

@ -134,10 +134,13 @@ class AsusWrtDeviceScanner(object):
for lease in leases_result:
match = _LEASES_REGEX.search(lease.decode('utf-8'))
if not match:
_LOGGER.warning("Could not parse lease row: %s", lease)
continue
# For leases where the client doesn't set a hostname, ensure
# it is blank and not '*', which breaks the entity_id down
# the line
if match:
host = match.group('host')
if host == '*':
host = ''
@ -151,6 +154,9 @@ class AsusWrtDeviceScanner(object):
for neighbor in neighbors:
match = _IP_NEIGH_REGEX.search(neighbor.decode('utf-8'))
if match and match.group('ip') in devices:
if not match:
_LOGGER.warning("Could not parse neighbor row: %s", neighbor)
continue
if match.group('ip') in devices:
devices[match.group('ip')]['status'] = match.group('status')
return devices