finity69x2 / nws_alerts

An updated version of the nws_alerts custom integration for Home Assistant
84 stars 29 forks source link

Task exception was never retrieved error since update to version 2.6 #49

Closed Anwen747 closed 1 year ago

Anwen747 commented 1 year ago

I have two active alerts right now, getting lots of these errors in my HA log:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/nws_alerts/sensor.py:135
Integration: nws_alerts (documentation, issues)
First occurred: 5:52:44 PM (27 occurrences)
Last logged: 8:53:48 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 381, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 586, in _async_write_ha_state
    attr.update(self.extra_state_attributes or {})
  File "/config/custom_components/nws_alerts/sensor.py", line 135, in extra_state_attributes
    attrs["title"] = self.coordinator.data["event"]
KeyError: 'event'

I was not getting these errors prior to updating the NWS integration in HACS. I see you listed a possible breaking change, but I don't know if I need to do something on my end, or if this is an issue in the integration.

finity69x2 commented 1 year ago

I'm on version 2.6 of my integration (and HA v2022.12.6) and I'm not seeing that error.

The breaking change was a small one and it only affected users who were using the split() method to access the attributes based on the attributes syntax change. So it wouldn't cause that error.

try uninstalling and re-installing the integration.

Sudo-Rob commented 1 year ago

Oops. After deleting and re-installation, it worked at first; but 20 minutes later, it's throwing errors.

finity69x2 commented 1 year ago

I'm really not sure where the source of that error might be.

I've had alerts since I updated to the latest version and I'm not getting any of those errors.

Anwen747 commented 1 year ago

I had it go away after restarting HA not long after I filed the issue, but then the errors came back. But I had an alert this morning and it didn't throw any errors. I did have multiple alerts when I was having the issue, and today was only a single alert - don't know if that has anything to do with it. I will keep an eye on it and let you know if it happens again.

finity69x2 commented 1 year ago

Sorry but I can't reproduce the error so there really isn't much I can do.