mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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
3fb691ead6
commit
dc4b0695b5
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