mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
more robust and more logging
This commit is contained in:
parent
f8bb807707
commit
158d9e27ff
@ -158,10 +158,13 @@ class AsusWrtDeviceScanner(object):
|
|||||||
for lease in leases_result:
|
for lease in leases_result:
|
||||||
match = _LEASES_REGEX.search(lease.decode('utf-8'))
|
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
|
# For leases where the client doesn't set a hostname, ensure
|
||||||
# it is blank and not '*', which breaks the entity_id down
|
# it is blank and not '*', which breaks the entity_id down
|
||||||
# the line
|
# the line
|
||||||
if match:
|
|
||||||
host = match.group('host')
|
host = match.group('host')
|
||||||
if host == '*':
|
if host == '*':
|
||||||
host = ''
|
host = ''
|
||||||
@ -175,6 +178,9 @@ class AsusWrtDeviceScanner(object):
|
|||||||
|
|
||||||
for neighbor in neighbors:
|
for neighbor in neighbors:
|
||||||
match = _IP_NEIGH_REGEX.search(neighbor.decode('utf-8'))
|
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')
|
devices[match.group('ip')]['status'] = match.group('status')
|
||||||
return devices
|
return devices
|
||||||
|
Loading…
x
Reference in New Issue
Block a user