tv3 / homeassistant-apsystems_ecur

Home Assistant custom component for local querying of APSystems ECU-R Solar System
6 stars 0 forks source link

Index out of range #7

Open dewi-ny-je opened 2 years ago

dewi-ny-je commented 2 years ago

Latest commit, error message

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/apsystems_ecur/sensor.py:131
Integration: APSystems PV solar ECU-R (documentation)
First occurred: June 27, 2022, 13:10:00 (141 occurrences)
Last logged: 08:08:58

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 270, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 330, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/config/custom_components/apsystems_ecur/sensor.py", line 131, in state
    return self.coordinator.data.get("inverters", {}).get(self._uid, {}).get("voltage", [])[0]
IndexError: list index out of range

And I don't see the power of each inverter. Total power and energy work.

dewi-ny-je commented 1 year ago

My system has DS3-L inverters and ECU-R PRO. I collected some data hoping you can find out why it's not working as expected. In the ZIP you find 3x webpages with the realtime data (full set of data, two with an inverter not reporting data likely because of low irradiation), a webpage with the power history, and some screenshots. report.zip

Let me know if you need more.

dewi-ny-je commented 1 year ago

I checked again and I noticed that the same error

return self.coordinator.data.get("inverters", {}).get(self._uid, {}).get("voltage", [])[0] causes sometimes missing voltage, or "0 V", or missing temperature, and maybe more.