Melcloud fails with daily energy consumption

Displaying daily energy consumption of my Melcloud heat pump fails, I get this in the logs:


Logger: homeassistant
Source: components/melcloud/sensor.py:66 
First occurred: 7:01:19 AM (31 occurrences) 
Last logged: 7:16:19 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 813, in _update_entity_states
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 669, in state
    value = self.native_value
  File "/usr/src/homeassistant/homeassistant/components/melcloud/sensor.py", line 184, in native_value
    return self.entity_description.value_fn(self._api)
  File "/usr/src/homeassistant/homeassistant/components/melcloud/sensor.py", line 66, in <lambda>
    value_fn=lambda x: x.device.daily_energy_consumed,
  File "/usr/local/lib/python3.10/site-packages/pymelcloud/device.py", line 210, in daily_energy_consumed
    consumption += self._energy_report.get(mode, [0.0])[-1]
IndexError: list index out of range

Also it seems I am unable to change the name of the heatpump in HA. How can I debug further?
I’ve tried reloading the integration, rebooting the whole RPi, disabling/enabling the Melcloud integration, removing, wait for day, add integration, renaming the device. None seem to help.

1 Like