briis / smartweather

WeatherFlow Smart Weather Component for Home Assistant
MIT License
108 stars 11 forks source link

Task exception was never retrieved #81

Closed dhover closed 3 years ago

dhover commented 3 years ago

I got an error saying:

2021-09-27 19:51:21 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 708, in _update_entity_states await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 451, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 500, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 190, in state_attributes if self.temperature is not None: File "/config/custom_components/smartweather/weather.py", line 112, in temperature if self._current is not None: File "/config/custom_components/smartweather/entity.py", line 51, in _current return self.coordinator.data[0] IndexError: list index out of range

What is wrong?

I am using Start Weather v2.2.9 on HA 2021.9.7 / HassOS 6.4

dhover commented 3 years ago

After a reboot the errors are gone!

yolani commented 3 years ago

I also see this exception, about 3-5 times per day:

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh update_callback() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 500, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 190, in state_attributes if self.temperature is not None: File "/config/custom_components/smartweather/weather.py", line 112, in temperature if self._current is not None: File "/config/custom_components/smartweather/entity.py", line 51, in _current return self.coordinator.data[0] IndexError: list index out of range

briis commented 3 years ago

These errors typically occur, when we cannot reach the WeatherFlow Server. I need to do better error handling on this. It can be a local internet issue, or the WeatherFlow servers can be temporarily unavailable. As @dhover found, rebooting or going to the Integrations page in HA, and then click the 3 dots in the lower right corner of the integration, and select Reload most often resolves these issues.

yolani commented 3 years ago

Sounds about right, since the data object is empty, it'S either a local issue or a general issue connecting to the weather flow servers.

I guess you should implement at least some exception handling to cover sporadic failures so the error logs don't pile up.

dhover commented 3 years ago

Sounds about right, since the data object is empty, it'S either a local issue or a general issue connecting to the weather flow servers.

I guess you should implement at least some exception handling to cover sporadic failures so the error logs don't pile up.

I agree. Some extra exception handling should prevent those errors.

briis commented 3 years ago

I will work on the error handling.