ReneNulschDE / mbapi2020

Custom Component to integrate MercedesME devices into Home-Assistant
Other
142 stars 27 forks source link

"Task exception was never retrieved" on HA 2024.5.5 #230

Closed JeeDeWee closed 1 month ago

JeeDeWee commented 1 month ago

The problem

When starting HA or when removing and re-adding the custom integration the following error is reported in the log:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_update_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 "/config/custom_components/mbapi2020/sensor.py", line 101, in state
    return datetime.fromtimestamp(int(self._state))
                                  ^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

What version of MBAPI2020 do use?

v0.13.0

What was the last working version of MBAPI2020?

No response

What type of installation are you running?

Home Assistant OS

Diagnostics information

config_entry-mbapi2020-84f261d8541921363d97f1a4aa0e1a4f.json

Anything in the logs that might be useful for us?

See log snippet above in post.

Additional information

It appears the integration is working normally. It just throws this error message everytime HA gets restarted. I have also tried to remove the integration and re-add the integration. Upon re-add, the same error message is thrown.

ReneNulschDE commented 1 month ago

Thanks for reporting. Unfortunately, I’m on vacation the whole May without an development device. I’ll fix it next weekend when I’m back home.

you could try to comment out the line 99 and 101 in the sensor.py - this should solve the problem until the fix is published.

ReneNulschDE commented 1 month ago

fixed with https://github.com/ReneNulschDE/mbapi2020/releases/tag/v0.15.0-beta.1 could you recheck it?

ReneNulschDE commented 1 month ago

Fixed with v0.15.0

JeeDeWee commented 1 month ago

fixed with https://github.com/ReneNulschDE/mbapi2020/releases/tag/v0.15.0-beta.1 could you recheck it?

I wasn't home but. I just checked with v0.15.0 and i did not see the error message anymore. All good!