Recently I started playing around with Home Assistant, to make my home smart and display useful metrics on a dashboard, e.g. calendar events. A few days ago I noticed specific calendar events crash the Home Assistant integration for a day. I don’t think this is exclusive to my environment and may be a global issue.
I’m using Home Assistant in conjunction with my selfhosted Baikal CalDAV server to display my calendar events on a dashboard in lovelace. After a few weeks of using this integration it suddenly crashed and no reboot was able to fix it. The calendar in Home Assistant was not displaying any events, but an error message that the integration crashed. Confused I started to dig around and after some time I was able to verify what causes the issue.
Surprisingly the issue lies with the type of event and the exact timing of said event. I was able to verify that a calendar event which is repeating every year (like a birthday) and set up to last the entire day crashes the integration only if this event is yesterday. If this event lies 2 days back or in the next days there is no issue. So the integration will suddenly work again once the day rolls over to the next day, if the event was yesterday.
I have opened an issue on Github and I hope someone will address this. Until then, if you don’t want calendar events to crash the Home Assistant calendar integration, it’s possible to modify the event to not be repeated every year or just live with a crashing integration for a single day – which may get annoying when you have mulitple events like that planned.
You can verify that you may be affected by this issue if you’re seeing the following error message in the log:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 558, in async_device_update raise exc File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 146, in update self.data.update() File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 280, in wrapper result = method(*args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 212, in update vevent = event.instance.vevent File "/usr/local/lib/python3.8/site-packages/vobject/base.py", line 531, in __getattr__ raise AttributeError(name) AttributeError: vevent 2021-07-24 23:59:44 ERROR (MainThread) [homeassistant.helpers.entity] Update for calendar.default_calendar fails Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/vobject/base.py", line 529, in __getattr__ return self.contents[toVName(name)][0] KeyError: 'vevent'