You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Navien custom component fails with a list index out of range. The error message in the Home Assistant log shows as:
2025-01-20 13:04:19.267 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback NavilinkConnect.async_handle_channel_status() (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/navien_water_heater/navien_api.py", line 339,
in async_handle_channel_status
channel.update_channel_status(channel_status.get("channel",{}))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/navien_water_heater/navien_api.py", line 383,
in update_channel_status
self.channel_status = self.convert_channel_status(channel_status)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/config/custom_components/navien_water_heater/navien_api.py", line 468,
in convert_channel_status
channel_status["unitInfo"]["unitStatusList"][i]["gasInstantUsage"] = round(c
hannel_status["unitInfo"]["unitStatusList"][i]["gasInstantUsage"] * GIUFactor *
3.968, 1)
~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
The error points to "[i]".
This configuration has 3 units on channel and 1 unit on channel 2. The failure occurs because the unitCount is returned as 3 (presumably for channel 1), the unitStatusList has only 1 list item at i=0, but lines 468-470 fail when accessing i=1 and i=2. I can avoid the error by continuing the for loop when i is greater than the length of the unitStatusList, but then I see only channel 1 unit 1 and channel 2 unit 1. I am unable to see information for channel 1 unit 2 and unit 3.
I unfortunately have not had a chance to review the Navien API response. It is likely the Navien API implementation is not processing all of the units on the channel and this part of the code assumes unitStatusList has all of the devices.
The text was updated successfully, but these errors were encountered:
tdfountain
changed the title
Error for list index when using NaviLink with multiple channels
Error for list index when using NaviLink with multiple units on the same channel
Jan 20, 2025
The Navien custom component fails with a list index out of range. The error message in the Home Assistant log shows as:
The error points to "[i]".
This configuration has 3 units on channel and 1 unit on channel 2. The failure occurs because the unitCount is returned as 3 (presumably for channel 1), the unitStatusList has only 1 list item at i=0, but lines 468-470 fail when accessing i=1 and i=2. I can avoid the error by continuing the for loop when i is greater than the length of the unitStatusList, but then I see only channel 1 unit 1 and channel 2 unit 1. I am unable to see information for channel 1 unit 2 and unit 3.
I unfortunately have not had a chance to review the Navien API response. It is likely the Navien API implementation is not processing all of the units on the channel and this part of the code assumes unitStatusList has all of the devices.
The text was updated successfully, but these errors were encountered: