mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
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:
parent
99ea1e3f4f
commit
ca3f07cdef
5
homeassistant/components/device_tracker/ubus.py
Normal file → Executable file
5
homeassistant/components/device_tracker/ubus.py
Normal file → Executable 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"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user