astrandb / miele

A modern integration for Miele devices in Home Assistant
MIT License
167 stars 24 forks source link

Errors in log with warming drawers #483

Closed IngmarStein closed 1 month ago

IngmarStein commented 1 month ago

The problem

I recently set up the integration and encountered the following errors which seem related to a warming drawer:

Error adding entity sensor.warmeschublade_verstrichene_zeit for domain sensor with platform miele
Error adding entity sensor.warmeschublade_gestartet_um for domain sensor with platform miele

After startup, the following error appears in the log every minute:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/miele/__init__.py", line 231, in _callback_update_actions
    coordinator.async_set_updated_data(coordinator.data)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 450, in async_set_updated_data
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 543, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/miele/sensor.py", line 819, in native_value
    mins = self._get_minutes()
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/miele/sensor.py", line 943, in _get_minutes
    self.coordinator.data[self._ent][self.entity_description.data_tag] * 60
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'state|elapsedTime|0'

Version of miele integration having the issue?

2024.3.0

Version of Home Assistant Core having the issue?

2024.5.4

Anything in the logs that might be useful for us?

No response

Additional information

No response

astrandb commented 1 month ago

Please get a diagnostic file from the command on the device screen. Drop the file into this issue so we can see what is going on in the API. The integration has worked with the warming drawer before so something might have changed in the API.

IngmarStein commented 1 month ago

Sure thing, here it is.

miele-39c2e8f597dcf73f1293e140e2c81a08-Wärmeschublade-a8d76503c04b2f63bc4d31b8a614362f.json

astrandb commented 1 month ago

It was like suspected. Miele has changed the data format slightly for the elapsed time sensor (without documenting the change). I will fix it in upcoming release of the integration.

IngmarStein commented 1 month ago

Thank you!