Skip to content

Commit

Permalink
device_tracker.ubus: Handle empty results (#7673)
Browse files Browse the repository at this point in the history
If OpenWRT isn't running the DHCP server then some OpenWRT hardware,
such as TP-Link TL-WDR3600 v1, can't determine the host
corresponding to an associated wifi client. This change handles that
by returning None when the request has no data in the result.
  • Loading branch information
tobygray authored and balloob committed May 22, 2017
1 parent 3fb691e commit dc4b069
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion homeassistant/components/device_tracker/ubus.py 100644 → 100755
Expand Up @@ -144,7 +144,10 @@ def _req_json_rpc(url, session_id, rpcmethod, subsystem, method, **params):
response = res.json()

if rpcmethod == "call":
return response["result"][1]
try:
return response["result"][1]
except IndexError:
return
else:
return response["result"]

Expand Down

0 comments on commit dc4b069

Please sign in to comment.