The problem
First of all, I believe this is a simple issue in the library that Home Assistant depends on to implement the local calendar integration. I've opened an issue to track there: allenporter/ical#257. I'm hoping through this issue we can both track the issue HA side, and if the PR is accepted we can update the dependency version and close this issue.
I'm slightly misusing the local calendar integration by maintaining the ICS file manually outside of Home Assistant and reloading the entity. The use case is to provide visibility of my local government's bin collection dates, and they provide an ICS file at some URL for this use case. The issue is that the ICS does not provide duration or end time, and the library is not currently using a default.
The file looks a bit like this:
BEGIN:VCALENDAR
PRODID:-//127.0.0.1//Waste Calendar Generator//
VERSION:2.0
X-WR-CALNAME:Bins Schedule
X-WR-CALDESC:Bins Schedule
X-WR-TIMEZONE:Europe/London
BEGIN:VEVENT
DTSTART;VALUE=DATE:20231212
SUMMARY:Black Bin Collection
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20231219
SUMMARY:Green Bin Collection
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20231219
SUMMARY:Blue Bin Collection
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20231228
SUMMARY:Black Bin Collection
END:VEVENT
END:VCALENDAR
When parsing the ICS file, Home Assistant generates an error and the calendar does not appear under "My Calendars" in the UI and the calendar entity is unavailable.
What version of Home Assistant Core has the issue?
core-2023.12.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
local-calendar / Calendar
Link to integration documentation on our website
https://www.home-assistant.io/integrations/local_calendar
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.components.calendar
Source: helpers/entity_platform.py:575
Integration: Calendar (documentation, issues)
First occurred: 09:32:50 (5 occurrences)
Last logged: 11:00:31
local_calendar: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 575, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 98, in async_update
if event := next(events, None):
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 369, in active_after
for item in self._iterable:
File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 252, in __next__
self._make_heap()
File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 242, in _make_heap
next_item = next(iterator)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 300, in __iter__
for item in self._iterable():
File "/usr/local/lib/python3.11/site-packages/ical/timeline.py", line 108, in sortable_items
yield SortableItemValue(event.timespan_of(tzinfo), event)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/ical/event.py", line 299, in timespan_of
normalize_datetime(self.start, tzinfo), normalize_datetime(self.end, tzinfo)
^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/ical/event.py", line 270, in end
raise ValueError("Unexpected state with no duration or dtend")
ValueError: Unexpected state with no duration or dtend
Additional information
Thanks all!
The problem
First of all, I believe this is a simple issue in the library that Home Assistant depends on to implement the local calendar integration. I've opened an issue to track there: allenporter/ical#257. I'm hoping through this issue we can both track the issue HA side, and if the PR is accepted we can update the dependency version and close this issue.
I'm slightly misusing the local calendar integration by maintaining the ICS file manually outside of Home Assistant and reloading the entity. The use case is to provide visibility of my local government's bin collection dates, and they provide an ICS file at some URL for this use case. The issue is that the ICS does not provide duration or end time, and the library is not currently using a default.
The file looks a bit like this:
When parsing the ICS file, Home Assistant generates an error and the calendar does not appear under "My Calendars" in the UI and the calendar entity is unavailable.
What version of Home Assistant Core has the issue?
core-2023.12.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
local-calendar / Calendar
Link to integration documentation on our website
https://www.home-assistant.io/integrations/local_calendar
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.components.calendar Source: helpers/entity_platform.py:575 Integration: Calendar (documentation, issues) First occurred: 09:32:50 (5 occurrences) Last logged: 11:00:31 local_calendar: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 575, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_device_update await self.async_update() File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 98, in async_update if event := next(events, None): ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 369, in active_after for item in self._iterable: File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 252, in __next__ self._make_heap() File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 242, in _make_heap next_item = next(iterator) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/ical/iter.py", line 300, in __iter__ for item in self._iterable(): File "/usr/local/lib/python3.11/site-packages/ical/timeline.py", line 108, in sortable_items yield SortableItemValue(event.timespan_of(tzinfo), event) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/ical/event.py", line 299, in timespan_of normalize_datetime(self.start, tzinfo), normalize_datetime(self.end, tzinfo) ^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/ical/event.py", line 270, in end raise ValueError("Unexpected state with no duration or dtend") ValueError: Unexpected state with no duration or dtendAdditional information
Thanks all!