t0mer / ims-custom-component

The Israel Meteorological Service (IMS) integration component for home assistant
MIT License
35 stars 8 forks source link

Log error (v0.1.11) #42

Closed amitfin closed 1 year ago

amitfin commented 1 year ago
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/ims/weather.py:248
Integration: The Israel Meteorological Service integration (documentation, issues)
First occurred: 10:48:52 AM (4 occurrences)
Last logged: 1:48:55 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 204, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 349, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 146, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 783, in state
    return self.condition
  File "/config/custom_components/ims/weather.py", line 248, in condition
    self._weather_coordinator.data.current_weather.weather_code
AttributeError: 'NoneType' object has no attribute 'weather_code'
GuyKh commented 1 year ago

I'm adding in 0.1.12 some handling when no data returns from IMS - that would cause presenting 'None' in HA, but no exceptions...

GuyKh commented 1 year ago

Try again with 0.1.12 - added some protections

amitfin commented 1 year ago

0.1.12 seems to solve it. Thanks!