Closed Friedi1970 closed 2 years ago
caldav documentation caldav source (message by IssueLinks)
used caldav
lib should be bumped to 0.8.0 which contains improvements for iCloud calendar handling.
@Friedi1970 when I create a PR to do so, would you be able to test if the PR fixes your issues?
EDIT: now I see, that you are using CalDAV server on Synology DSM, but I guess an iPhone as client device? Those if the PR (Bump caldav to 0.8.0) does not fix your issue, a new issue must be opened in https://github.com/python-caldav/caldav
used
caldav
lib should be bumped to 0.8.0 ~which contains improvements for iCloud calendar handling.~ @Friedi1970 when I create a PR to do so, would you be able to test if the PR fixes your issues?EDIT: now I see, that you are using CalDAV server on Synology DSM, but I guess an iPhone as client device? Those if the PR (Bump caldav to 0.8.0) does not fix your issue, a new issue must be opened in https://github.com/python-caldav/caldav
Yep, it's from an iPhone. Would it be sufficient to open the issue in the same manner as this one? So, I'd copy the text of this one or how shall I do?
ANd: Of course I could test :)
Would it be sufficient to open the issue in the same manner as this one? So, I'd copy the text of this one or how shall I do?
Yeah, I guess this should be sufficient, if not, they will ask for more details 😉
ANd: Of course I could test :)
that's great 👍 than please test the linked PR 😄
that's great 👍 than please test the linked PR 😄
I am not so well in github things. What do I need to do?
The easiest way is, you copy all three files from caldav (from my branch) into config/custom_component/caldav
folder on your HA (create folders if not existing), than add a fake version into manifest.json
:
{
"domain": "caldav",
"name": "CalDAV",
"documentation": "https://www.home-assistant.io/integrations/caldav",
"requirements": ["caldav==0.8.0"],
"codeowners": [],
+ "version": "1.0",
"iot_class": "cloud_polling"
}
afterwards reboot your HA.
Unfortunately the problem still exists.
What's next?
Ok, than the next step is to open an issue in https://github.com/python-caldav/caldav.
@mib1185 I opened the issue.
Can you help here: https://github.com/python-caldav/caldav/issues/151#issuecomment-921007069
I really have no idea how to deal with it :-/
The ical data in the calendar is likely to be slightly broken, this causes the vobject library to raise an exception (the icalendar library just ignores the problem but also throws away the extra location line, so that's probably not much better). Unfortunately I don't have access to the ical data (in version 0.8.0 of caldav, the broken ical is logged through a logging.critical
and will end up at stderr unless the logging is set up to log somewhere else). I'm trying to be pragmatic with such, the code already contains some hacks to "repair" broken ical data. In the master branch of the caldav library, I've now added a hack to remove trailing whitespace from the ical lines, based on an earlier bug report in https://github.com/python-caldav/caldav/issues/37 - perhaps this will solve this issue as well.
It would be very useful to have the ical data available. It is apparently not getting through to the home assistant error log.
Unfortunately I know nothing about Home Assistant, and I'm not very good at giving end-user support (after all I'm just the maintainer of a python library) :-)
@Friedi1970 would suggest to enable debug logging for both the integration (homeassistant.components.caldav
) and the library (caldav
) - to do so add the following to your configuration.yaml
file:
logger:
default: info
logs:
homeassistant.components.caldav: debug
caldav: debug
In combination with https://github.com/home-assistant/core/issues/55778#issuecomment-913807818 this might enable the by @tobixen requested logging and put it into the home-assistant.log
. Here you will find further information, how to access this log file.
Nevertheless, the logfile can also be accessed via the UI: Configuration -> scroll down -> Logs -> scroll down -> Load full home assistant log
In this case, probabiy "error" would do instead of "debug". There will be a lot of logging with "debug" logging turned on.
In this case, probabiy "error" would do instead of "debug". There will be a lot of logging with "debug" logging turned on.
Better too much, than too less logging 😁
I'm not 100% sure if this is related, but if noticed that if i try to add a calendar that has been shared, no events show up in the Homeassistant calendar, if i add a calendar that has not been shared, it seems to work fine.
I also seem to have issues if there are multiple calendars/task lists that are named the same. For example, in Nextcloud i have a calendar named 'General' and a task list named 'General' as well. When loaded in homeassistant, they both show up, but neither of them display any events.
For reference, i'm using nextcloud calendars.
Most likely not related, but it is probably a good idea to turn on logging as shown in https://github.com/home-assistant/core/issues/55778#issuecomment-925156198
EDIT:
Okay I found the one failing in the logger as for some reason this is the only entry that has geo longitude latitude. Went into my icloud calendar and just removed the location and it started working again.
Now I'm just trying to figure out HOW I put in the location data... As I have location data on some other entries as well that is working properly this is wierd.
OG post:
I have the same problem with CalDav and iCloud. It seems location data is the problem here. I did run the logger but it kind of shows a lot of calendar entries and as I share them with other people I don't feel comfortable sharing them.
My setup is really similar to the one above except I'm using URL: https://caldav.icloud.com
and has been working flawlessy for months and it just one of three calendars that don't show up.
Is there something specific in here I'm looking for? Maybe I can pin-point it and share just that part?
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 618, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 135, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 277, in wrapper
result = method(*args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 201, in update
vevent = event.instance.vevent
File "/usr/local/lib/python3.9/site-packages/caldav/objects.py", line 1058, in _get_vobject_instance
self._set_vobject_instance(vobject.readOne(to_unicode(self._get_data())))
File "/usr/local/lib/python3.9/site-packages/vobject/base.py", line 1155, in readOne
return next(readComponents(stream, validate, transform, ignoreUnreadable,
File "/usr/local/lib/python3.9/site-packages/vobject/base.py", line 1101, in readComponents
vline = textLineToContentLine(line, n)
File "/usr/local/lib/python3.9/site-packages/vobject/base.py", line 925, in textLineToContentLine
return ContentLine(*parseLine(text, n), **{'encoded': True,
File "/usr/local/lib/python3.9/site-packages/vobject/base.py", line 813, in parseLine
raise ParseError("Failed to parse line: {0!s}".format(line), lineNumber)
vobject.base.ParseError: At line 34: Failed to parse line: 25550 Svenljunga\nSverige":geo:55.154211,13.75240
I was holding a talk on caldav server compatibility issues the other day, and someone in audience could confirm that the X-APPLE-STRUCTURED-LOCATION was a well-known notorious trouble-maker.
I read the error message above as the problem is actually not on the line with the zip-code and coordinates, but on the preceding line. Perhaps there is an extra new-line there that is printed as a new-line directly in the icalendar file. In that case, my fix for removing extra white space at the end of a line would not suffice. I think the problem shown above can also be mended. In any case, I need the icalendar data itself to be able to make a good fix including a test suite.
I need the icalendar data itself to be able to make a good fix including a test suite.
What exactly do you need? Is that anything I can get for you? And if, how?
If you turn on logging as shown in https://github.com/home-assistant/core/issues/55778#issuecomment-925156198 and run the most recent release of the caldav library as shown in https://github.com/home-assistant/core/issues/55778#issuecomment-913807818 then the icalendar data is supposed to end up in the logs.
If you turn on logging as shown in #55778 (comment) then the icalendar data is supposed to end up in the logs.
Look at my edit in the post, is that what your after? For some reason I can't add it here again
Somehow the edit first turned up blank and then disappeared completely. Maybe it contained personal data and github automatically deemed it shouldn't be out in the public? You may send it by email as well, use t-broken-icalendar@tobixen.no :-)
Somehow the edit first turned up blank and then disappeared completely. Maybe it contained personal data and github automatically deemed it shouldn't be out in the public? You may send it by email as well, use t-broken-icalendar@tobixen.no :-)
Haha oh thats why! Ok, I sent you the snippet :)
Got it.
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS="X\xc3\xaXX All\xc3\xa9 NN\\n25550
Svenljunga\\nSverige";X-APPLE-ABUID=Hem;X-APPLE-MAPKIT-HANDLE=CAES2wEI2TIaE
gmB(...)
My guess is that it's the extra unquoted space there that is breaking things, but I will look into it. Anyway, it looks a bit strange, because this is not exactly the same data as is shown in the error message above.
Edit: or maybe not, a bit below it says ...
X-APPLE-RADIUS=71.5874129764782;X-APPLE-REFERENCEFRAME=1;X-TITLE="X\xc3\xa4XX
XX All\xc3\xa9 NN":\n25550 Svenljunga\\nSverige":geo::55.(...)
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS="X\xc3\xaXX All\xc3\xa9 NN\\n25550 Svenljunga\\nSverige";X-APPLE-ABUID=Hem;X-APPLE-MAPKIT-HANDLE=CAES2wEI2TIaE gmB(...)
My guess is that it's the extra unquoted space there that is breaking things, but I will look into it. Anyway, it looks a bit strange, because this is not exactly the same data as is shown in the error message above.
Don't look to much at the exact geo-numbers/adress stuff as I changed them a little just to not reveal the true position as I was about to share it with internet 😄 But I left all the quotes and stuff alone.
When I looked at it in the iCloud webpage the location information was just stuffed in there with no space or anything. I tried to add new to an event from my phone to see if I could get it to break again but I haven't had any luck with it. In the Calendar app on iOS when adding a location I tried both using my own contact information and use the "current location" as I'm at home right now but non of them broke it.... so I don't have a clue what went on when I added that location information the first time.
Right. Coordinate seemed a bit off indeed, I considered 55 degrees north must be the very south tip of Sweden, but it's indeed a bit out in the Baltic sea already :-)
I'm able to read the ical data given into vobject without any errors and transform it back to a string, so the ical data that was sent to me by email seems to be valid. So this is a dead end. :/
I'm able to read the ical data given into vobject without any errors and transform it back to a string, so the ical data that was sent to me by email seems to be valid. So this is a dead end. :/
Damn. Unfortunately the log is reset so I can't get the OG message... we'll have to wait and see if it breaks again 😞
EDIT: Wait a moment! I might have found it! Sent it to you
Still no "luck". The icalendar data looks valid and goes right into vobject without any problems.
Still no "luck". The icalendar data looks valid and goes right into vobject without any problems.
Hmm okay, then I have no clue
python-caldav 0.8.1 was just released. I would be happy if someone could check if that solves the problems.
python-caldav 0.8.1 was just released. I would be happy if someone could check if that solves the problems.
Do I need to install this release? If yes, pls tell me how.
if no: the error still exists :(
Probably, yes.
I have installed Home Assistant myself now, so I'm a bit more clever on it, but I still didn't get time to look into the calendar integration, so I'm not sure how to upgrade the caldav library.
Any news regarding this issue? The last core version of Home Assistant still have the error.
I will hopefully have time to look into caldav-homeassistant over the next couple of weeks (I'm still working on stuff like soldering LED-strips, installing thermometers, fixing the heating to be turned off when I'm not at home or asleep, and turned on a couple of hours before I get up ... but, came to think, it would be awesome if I could control the heaters thruogh a calendar!).
Except for that, it would help me enormously if I could reproduce the problems on my own. If I could either have access to a calendar server/account having this problem, or if I could give you access to a calendar server so you could put in an event that breaks. Is that an icloud calendar you're having trouble with?
To just try the new library version, perform steps from https://github.com/home-assistant/core/issues/55778#issuecomment-913807818 but also change the library version in manifest file like
{
"domain": "caldav",
"name": "CalDAV",
"documentation": "https://www.home-assistant.io/integrations/caldav",
- "requirements": ["caldav==0.8.0"],
+ "requirements": ["caldav==0.8.1"],
"codeowners": [],
"version": "1.0",
"iot_class": "cloud_polling"
}
If I could either have access to a calendar server/account having this problem, or if I could give you access to a calendar server so you could put in an event that breaks. Is that an icloud calendar you're having trouble with?
I think it’s not a server side problem of CalDAV. It happens only when I add a location to an appointment using an IOS device.
To just try the new library version, perform steps from #55778 (comment) but also change the library version in manifest file like
Ah 🤦♂️ Thanks for the hint! I will try after X-Mas. If I do before the WAF will decrease to a minus value 🙄
I think it’s not a server side problem of CalDAV. It happens only when I add a location to an appointment using an IOS device.
From my perspective it's a problem with the IOS device, feeding the calendar with broken data.
The libraries that the caldav library depends on (icalendar, vobject - two competing libraries actually) both rejects the invalid data, and I believe most calendar servers will also reject it.
It's my wish to be pragmatic and friendly in the caldav library, hence I've added some more code in v0.8.1 that tries to repair obviously broken icalendar data. Now I'm just very curious if this fix will solve your problem :-)
(and, I'm quite impressed by Home Assistant now after playing a bit with it. Earlier I didn't see any bigger need for "smart house solutions". We're in the middle of a "perfect storm" now due to very low Russian gas deliveries either due to a cold winter in Russia or due to political conflicts around the "North Stream 2"-project, planned shutdown of German nuclear reactors, maintenance of French nuclear reactors, wind that isn't blowing, southern Norwegian hydro power dams that are almost empty due to a shortfall of rain during the summer season and whatnot - in my region we've always had cheap electricity, now the average day price has grown with like 10x and the peak five percentile prices has grown with more than 20x. While the normal people are complaining and whining, I'm saving money by the buckets by taking fine precision control of the electricity consumption - plus donning my woolen long johns, a woolen hat and a fleece jacket. Perhaps I should force people to book appointments on a calendar for taking a shower, and then some advanced logic depending on the electricity price fluctuations etc could turn on the heater in the hot water tank in good time before the showering event ... hm. Admittedly the prices probably have to stay at this level for a long time before I will be able to repay all the hardware costs ... minor detail. Anyway ... I digress ...) :-)
Calendar integration installed, I've set up a new calendar for "booking" appointments for the kitchen. That will be a major step forward from my first iteration, where I simply had a fixed time in the morning for turning on the heat, manual adjustments in the daytime, and a fixed time in the evening for turning down the heat.
I do see that the caldav version is pinned to an old version, which is quite bad as I'm continuously working with solving compatibility problems. Even my own calendar was not supported with the elder version of the caldav library. I think I will raise a separate issue for that.
There is already the #55815 pull request out there, but I'm not allowed to comment on it.
I'm continuously putting in compatibility fixes and workarounds, and I'm going to great lengths to ensure backward compatibility, so there are good reasons for sticking to the latest release and no point pinning an old version on the caldav version. In fact, to support my own current personal calendar I needed to bump the version to 0.8.2 (due to a bugfix supporting non-ascii characters in the password).
It would be nice to bump it to 0.8.2. @mib1185 ... could you do it?
Hi @tobixen all libraries - used by integrations - are pinned to a version to ensure that each environment out there is on the same state and unforseen changes in the library cannot influence the HA system at all 😉 in short it is about stability and reliability of the whole HA environment. So if you feel, the library should be bumped to a higher/next version, than feel free to open an PR on your own, explain in short the advantages of the new version, provide at least the link to the release notes and a link to the comparison of the current used version and the new one (compare with #55815 how to do). and for sure, don't hesitate in case you have any questions 😉
Ok, I'll make an effort on it as soon as I get time
Edit: perhaps I'll wait for more feedback from @Friedi1970 in case his problem is not fixed in version 0.8.2 but will be fixed in version 0.8.3 :-)
@Friedi1970, do you have the possibility to send calendar invites to arbitrary email addresses from your calendaring system? And if so, could you create some event with a location and invite me? Send the invite to tobias@redpill-linpro.com
To be honest, I never did but afaik it is not possible. It would only be possible if I‘d use the Apple calendar including Apple mail mail and cloud and that‘s what I don‘t use … I use CalDAV on a Synology with shared calenders.
To just try the new library version, perform steps from #55778 (comment) but also change the library version in manifest file like
{ "domain": "caldav", "name": "CalDAV", "documentation": "https://www.home-assistant.io/integrations/caldav", - "requirements": ["caldav==0.8.0"], + "requirements": ["caldav==0.8.1"], "codeowners": [], "version": "1.0", "iot_class": "cloud_polling" }
I tried the master of your branch but I get this error:
Logger: homeassistant.config
Source: loader.py:535
First occurred: 09:39:20 (1 occurrences)
Last logged: 09:39:20
Platform error: calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 887, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 530, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 535, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.caldav.calendar
how exactly did you try this? and yes, the mentioned branch does not exist anymore, so you can just take the caldav folder from dev
branch.
Hi, i opened a PR #63280 to bump to 0.8.2 version
how exactly did you try this? and yes, the mentioned branch does not exist anymore, so you can just take the caldav folder from
dev
branch.
OK, then I need to redo ...
are there any news on this? the bumbed version is already part of HA since 2022.2
The problem
Hi all,
Actually with the integration everything is working well but after restarting HA I realized the following problem with CalDAV. The thing is that suddenly no calendar data were loaded. Therefore I went to logs and got the following:
In the last line there is the parse error. What is really starnge for me is the fact that as soon as I delete the location from the corresponding event everything works fine again. Of course I have a lot of events with locations and only in some cases this error occur. In this case the address is as follows:
Taverna Georgios Kunigundenruhstraße 30, 96050 Bamberg, Deutschland
It seems the integration has a problem with locations.
The other strange thing is, that this event does not match the the search condition for the custom calendar.
Here's the YAML:
What is version of Home Assistant Core has the issue?
core-2021.9.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
CalDAV
Link to integration documentation on our website
https://www.home-assistant.io/int…
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response