Problems with CalDAV and iCloud

I have a problem with the CalDAV integration. I am trying to import an iCloud calendar. Unfortunately, this works very unreliably. Several times per hour I get the error message in the user interface ‘Error while fetching calendar. Response error: 400’. Sometimes even 500.
The log file says :

homeassistant  | 2024-10-03 21:43:45.576 ERROR (SyncWorker_39) [root] ---
homeassistant  | +++
homeassistant  | @@ -5,7 +5,6 @@
homeassistant  |  BEGIN:VEVENT
homeassistant  |  DTSTAMP:20241003T214345Z
homeassistant  |  CREATED:20230910T173836Z
homeassistant  | -DTSTAMP:20230910T173837Z
homeassistant  |  SEQUENCE:0
homeassistant  |  SUMMARY:Geburtstag Estelle
homeassistant  |  UID:7EAC0253-F358-42C4-B7D0-5EC78B867C14
homeassistant  | 2024-10-03 21:47:48.892 ERROR (MainThread) [aiohttp.server] Error handling request
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
homeassistant  |     resp = await request_handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
homeassistant  | 2024-10-03 21:48:50.568 ERROR (MainThread) [aiohttp.server] Error handling request
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
homeassistant  |     resp = await request_handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
homeassistant  |     resp = await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
homeassistant  |     return await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
homeassistant  |     return await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
homeassistant  |     return await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
homeassistant  |     return await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
homeassistant  |     return await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
homeassistant  |     return await handler(request)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
homeassistant  |     response = await handler(request)
homeassistant  |                ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
homeassistant  |     result = await handler(request, **request.match_info)
homeassistant  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/calendar/__init__.py", line 648, in get
homeassistant  |     calendar_event_list = await entity.async_get_events(
homeassistant  |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 200, in async_get_events
homeassistant  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
homeassistant  |     result = self.fn(*self.args, **self.kwargs)
homeassistant  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/caldav/objects.py", line 1079, in search
homeassistant  |     (response, objects) = self._request_report_build_resultlist(
homeassistant  |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/caldav/objects.py", line 958, in _request_report_build_resultlist
homeassistant  |     response = self._query(xml, 1, "report")
homeassistant  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.12/site-packages/caldav/objects.py", line 216, in _query
homeassistant  |     raise error.exception_by_method[query_method](errmsg(ret))
homeassistant  | caldav.lib.error.ReportError: ReportError at '503 Service Unavailable
homeassistant  |
homeassistant  | b''', reason no reason

Sometimes everything is displayed correctly and then an error message appears again with the next update.

Information about my system:

  • HomeAssistant 2024-9-3
  • running on Docker
  • I configured the calendar with the UI (not in yaml)
  • I added an app-specific password

Does anyone know the problem? Any tips on how I can fix this?

1 Like

I have a similiar issue. I set up CalDAV last week, managed to get our Family calendar setup with Public access and had it all appear in HA no problem. This week I’m getting 400 or 500 errors. When I 1st set it up I was able to use a browser and go to http://pxx-caldav.icloud.com and would be prompted for username and password which I was able to use the generated app password to log in. Now I visit the page and just receive “You don’t have the user rights to view this page” with no prompt for a password.

I switched to a custom HACS integration. franc6/ics_calendar

It downloads the ics calendar data every 15 minutes and updates the calendar.
You have to use the public calendar URL (e.g. https://pxxxxx-caldav.icloud.com/published/2/M4vAETBP0IpjkI)

I had some problems with recurring items, but it works if you use the ‘rie’ parser instead of the ‘ical’ parser.

So the calDAV problem isn’t solved, but this could be a workaround until it is fixed.

Having these issues as well with CalDAV.

caldav.lib.error.PropfindError: PropfindError at ‘503 Service Unavailable
b’‘’, reason no reason

Going to try ICS again. Don’t need it super responsive so ICS might work for me.