Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalDAV iCloud Sign-in Error on Home Assistant: Path Handling Problem #393

Closed
gtmax500 opened this issue Apr 17, 2024 · 3 comments
Closed

Comments

@gtmax500
Copy link

Hello,

I have had the CalDAV integration in Home Assistant working with my iCloud calendars for a few weeks now but about a week ago I started getting sync errors. I deleted the integration and tried to log in again but it keeps failing with an “unknown error occurred”.

I did find this error in the logs which asked me to raise an issue here though I could not find the traceback:

Logger: caldav
Source: /usr/local/lib/python3.12/site-packages/caldav/objects.py:303
First occurred: April 13, 2024 at 08:59:55 (6 occurrences)
Last logged: 21:27:54

Possibly the server has a path handling problem, possibly the URL configured is wrong. Path expected: /.well-known/caldav, path found: ['/8034509913/principal/'] Please raise an issue at https://github.com/python-caldav/caldav/issues or reach out to t-caldav@tobixen.no, include this error and the traceback and tell what server you are using. Continuing, probably everything will be fine

I am not sure this is the cause of my login issue but it may be a part of it. I am also not sure which version of python-Caldav I am running but here is a link to the source code .

My login settings to connect to my iCloud calendar are:

Calendar URL: https://caldav.icloud.com/.well-known/caldav
Username: iCloud username
Password: iCloud App Specific Password (Format: xxxx-xxxx-xxxx-xxxx)

Again, it was working for a little while using those settings but now I can’t login.

@tobixen
Copy link
Member

tobixen commented Apr 17, 2024

Try to use only https://caldav.icloud.com/ as the URL - though, the warning above indicates that things are working anyway.

If things have stopped working, then something must have changed. If you haven't changed the configuration or upgraded HomeAssistant, then it's likely that the change is at the server side. I've found that there is absolutely no official information stating that iCloud supports the CalDAV protocol - so Apple is free to cripple the service or shut it down completely - though I expect that it will be quite clear both in the issue tracker on HomeAssistant, the python-caldav library and other places if this is a general problem affecting all iCloud users. Could it be that the app-specific password has a lifetime and has expired?

@gtmax500
Copy link
Author

Turns out it was because I had IPV6 enabled in HomeAssistant. After disabling IPV6, I was able to log in to my iCloud account through the HomeAssistant CalDAV integration in an instant. I am not sure how IPV6 suddenly got enabled but thank you for the prompt assistance in any case.

@tobixen
Copy link
Member

tobixen commented Apr 18, 2024

I'm more wondering why this error would occur with IPv6 in the first place. The common pitfall with dual-stack implementations (systems set up with both IPv4 and IPv6) is that firewalls are configured differently or that some DNS pointers are wrongly set up, causing timeout issues or connection issues, not "unknown error" after doing some parts of the handshake. Well, the iCloud caldav implementation has some kind of sharding going on, you start with caldav.icloud.com, and then one gets redirected to something like caldav-p642.icloud.com if I remember correct - could be that the AAAA-record for caldav.icloud.com is correct while AAAA for caldav-p642.icloud.com is incorrect.

In any case, happy that the problem got solved, and if anyone else has problems with iCloud, I will try to remember to ask them to check if they are on IPv4 or IPv6 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants