CestLaGalere / mobilealerts

Retrieves sensor data for Mobile Alerts sensors for Home Assistant
Apache License 2.0
16 stars 6 forks source link

Retrieving data stops after some time #16

Closed helmut-hackl closed 9 months ago

helmut-hackl commented 9 months ago

After starting the integration it seems to work fine, but running a few hours there is no data received anymore. The log shows the following error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 243, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 399, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_update_listeners
    update_callback()
  File "/config/custom_components/mobile_alerts/sensor.py", line 200, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 947, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 524, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mobile_alerts/sensor.py", line 256, in native_value
    if val > 100 or val < 0:
       ^^^^^^^^^
TypeError: '>' not supported between instances of 'str' and 'int'

Is this caused by the integration or an error in the API?

petrleocompel commented 9 months ago

Is it tested with latest version?

helmut-hackl commented 9 months ago

Yes v1.2.1 - I think this is latest ...

petrleocompel commented 9 months ago

Should be fixed in v1.2.2

reopen in any case again