"List index out of range" error using Hunter Hydrawise integration.
See original GitHub issueThe problem
I am attempting to integrate our Hunter Hydrawise irrigation controller into Home Assistant, but I noticed that everything isn’t working perfectly due to some errors (logs included). In my configuration.yaml file I have the following two lines to enable the integration,
hydrawise:
access_token: "XXXX-XXXX-XXXX-XXXX"
where X represents the characters in my API key.
Adding a sensor, switch, or binary sensor triggers the errors in the log.
binary_sensor:
- platform: hydrawise
sensor:
- platform: hydrawise
switch:
- platform: hydrawise
What is version of Home Assistant Core has the issue?
core-2021.9.7
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Hunter Hydrawise
Link to integration documentation on our website
https://www.home-assistant.io/integrations/hydrawise/
Example YAML snippet
binary_sensor:
- platform: hydrawise
switch:
- platform: hydrawise
sensor:
- platform: hydrawise
Anything in the logs that might be useful for us?
Logger: homeassistant.components.binary_sensor
Source: components/hydrawise/binary_sensor.py:56
Integration: Binary sensor (documentation, issues)
First occurred: 15:55:33 (1 occurrences)
Last logged: 15:55:33
hydrawise: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 633, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/hydrawise/binary_sensor.py", line 56, in update
relay_data = mydata.relays[self.data["relay"] - 1]
IndexError: list index out of range
Logger: homeassistant.components.switch
Source: components/hydrawise/switch.py:87
Integration: Switch (documentation, issues)
First occurred: 16:05:18 (1 occurrences)
Last logged: 16:05:18
hydrawise: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 633, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/hydrawise/switch.py", line 87, in update
self._state = (mydata.relays[relay_data]["timestr"] != "") and (
IndexError: list index out of range
Logger: homeassistant.components.sensor
Source: components/hydrawise/sensor.py:58
Integration: Sensor (documentation, issues)
First occurred: 16:05:18 (2 occurrences)
Last logged: 16:05:18
hydrawise: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 633, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/hydrawise/sensor.py", line 58, in update
relay_data = mydata.relays[self.data["relay"] - 1]
IndexError: list index out of range
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Hydrawise Empty Zones Throw Out of #37769 - GitHub
It seems the problem is around unused/unnamed zones that may appear in between zones that are used. Is that correct? That is correct....
Read more >Hydrawise Manual - Troubleshooting
1. Check that your wireless router and controller are powered on. 2. Verify serial numbers in the software match the number in the...
Read more >Hydrawise not working in 0.106 - Home Assistant Community
The IndexError: list index out of range problem I was having was caused by having an empty zone. When my system was installed...
Read more >South of the border with Hunter Industries
Every solenoid valve that comes off the manufacturing line is individually tested both electrically and hydraulically. Rotors are tested with air, and samples ......
Read more >Lutron - Bindings - openHAB
Lutron RadioRA 2/HomeWorks QS/RA2 Select/Caseta Binding. Note: While the Lutron Integration Protocol used by ipbridge in this binding should largely be ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey All, I’m so sorry for not being engaged on this. I’m not sure what the issue is here. If I can get time I’ll look at it. But, I’m not sure how much help I can be any longer because I do not have access to a Hunter unit to test. I sold my house with the irrigation unit and live in an apartment now.
I’m wondering if Hunter has changed the API again and broken this integration. Their past API support was never great, and was slowly deteriorating as they were shifting from an open API to a more closed system. Their most recent API document didn’t match their implementation. Their documentation also says they may depreciate parts of it at any time. That’s why I’m suspicious.
On Wed, Mar 9, 2022 at 7:03 AM sipossz @.***> wrote:
So, after ignoring this issue for more than month ( sorry ), I finally found the issue 🎉 ,so here goes:
Problem
I have the Pro HC Controller which has 24 configurable zones. All of the zones are configured, except for zone 20, which we disconnected and removed its description ( for a reason that I cannot remember ). In this state, if I perform an API request with https://api.hydrawise.com/api/v1/statusschedule.php?api_key= , with my API key appended to the end ( as generated by the website ), then I receive back:
so I think the index out of range Issue comes from code trying to access xxxxxx for which there is an id, but no relay_id. I hope this makes sense.
Solution
What solves these index out of range errors I receive in the Home Assistant logs as soon as I create a sensor, binary sensor, or switch: is creating a blank zone ( giving it a name like “Nothing” ) and assigning it to zone 20 resulting in 24x {“relay_id”:xxxxxx, …, …, …} being sent when I do an API request, meaning Home Assistant gets what it needs and does not freak out about a id:xxxxxx for which there is no corresponding relay_id.
Conclusion
So far I have only implemented a switch ( and not a sensor or binary sensor), and have not yet received an index out of range error, so I truly think the above observation was the cause of the errors.
Hopefully my findings help someone else too.