device_tracker.ubus: Handle empty results (#7673)

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.
This commit is contained in:
tobygray authored and Paulus Schoutsen committed 2017-05-21 17:26:05 -07:00
1 parent 99ea1e3f4f
commit ca3f07cdef
1 file changed
+4 -1
+4 -1
View File
@@ -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"]