ICS Calendar platform

It has to parse the entire file before it can know what is old. It can’t even just skip X number of lines, because of recurring events. The current parsers are slow, but they do run asynchronously, so it shouldn’t be causing any large problem, unless, of course, you are running HA on a small system, like a raspberry pi. Both parsers also use lots of RAM, and the larger the file, the more RAM will be used. And that’s probably the cause of slowness with a large file.
I am working on another parser, but it doesn’t handle time zones at all, and I don’t think it calculates recurring events. So it’s got a ways to go. But I won’t have time for personal projects until next month, and you’re kinda stuck with “it’s good enough for me,” so it’s not at the top of my priority list. If anyone wants to help, I’ll gladly accept the help. :slight_smile:

1 Like

Hi!
First of all - Thanks for creating your code and making it available to everyone! Highly appreciated! :slight_smile:

So I think that my problem is that the calendar is simply too large. I have a pretty large x86/64 system running HA OS but this code simply makes everything sluggish. And when I go to the Calendar view I sometimes see the calendar entries, but sometimes they are gone or getting repopulated over and over.

How does it really work? Do you fetch and store it in a database locally?

Honestly i dont think its slowing HA due to the number of events or length; I imported a subscribed ics with literally only 8 days of events, and my entire HA system has slowed to a crawl since. I cant explain why either. Motion sensors take 15-25 seconds to trigger events, lights take around the same. It seems like this intergration is taking up resources constantly for some reason. I’ve gone through the code a few times, and i still cant figure out why it would be. But as soon as i remove the component, everything is back to normal. Super strange e

Hi There
could anybode let me know how to integrate a local stored calender into ICS. It’s stored on my SDD (use HA on a PI4), so how to address the local folder? I have tried several options as described, but no success. Even not with the external link stored/showed in the description. Thank you for any help.
On an external link I get: “The downloaded file can not be parsed, not a valid ICS file.”
Any help??

JJ

That doesn’t quite look like an error message from my ics_calendar project. I do know my project isn’t designed for reading from local files, largely because it’s difficult to make a file local to most types of HA installations. If you can make it a truly local file, try file:///absolute/path/to/ics/file. Note the three slashes after “file:”. I am curious about the error message, though. Can you send me the actual log output privately?

Hi, thank you for our reply. It looks I have been able to solve the issue. Following local link does work with my configuration HA on PI4 running: http://localhost:8123/local/calendar.ics

regards JJ

1 Like

I’ve started using ICS to pull through my work schedule for shifted days…I can see the date and times of the next upcoming 3 dates but the time is showing as UTC rather than my native timezone of Europe/London. All other times are correct apart from this particular HACS integration…is this a bug…or does it need some sort of another fix that I need to implement myself?

There a few possibilities here. Can you post your calendar to me privately? Please remove any personal info, e.g. just change the description, summary, etc to something generic, numbered so I can distinguish them. Also, please send me your config; I don’t need the URL, username, or password, just the other fields. That will help me figure out where the problem is. I suspect a bug somewhere, just not sure if it’s in my code, the parser, or even the calendar. A lot of programs might think your time zone is UTC, as that’s a common mistake. :frowning:

Works perfect. Just remember to put the file into ./config/www/

Hello,

I got a weird problem concerning the ICS calendar platform and all day events that last one single day.
I managed to connect my Kopano calendar to HomeAssistant via SSL (Let’s encrypt).

Everything else works fine:

  • umlauts
  • all day events that last two or more days
  • events that last a certain period of time, e. g. 8 am to 7 pm

As soon as I create an all day event that lasts one day, it is recognized for the day before.
Example:

  • event is created for 2022/09/11, all day
  • my mobile phone recognizes that event for 2022/09/11, all day
  • Kopano WebApp recognizes that event for 2022/09/11, all day
  • HomeAssistant recognizes that event for 2022/09/10, all day

This is an excerpt from the .ics-file:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Kopano//11.0.2//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-INTENDEDSTATUS:FREE
CREATED:20220907T230853Z
LAST-MODIFIED:20220907T230901Z
DTSTAMP:20220907T230901Z
DTSTART;VALUE=DATE:20220910
DTEND;VALUE=DATE:20220911
SUMMARY:Test WebApp ganztägig 11.09.
PRIORITY:5
CLASS:PUBLIC
UID:
040000008200E00074C5B7101A82E008000000008064F3D00EC3D801000000000000000001
 000000C5EA678954DE4A9D840365DFBE14C377
X-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE:20220908T075343Z
X-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE:20220908T075343Z
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-OWNERAPPTID:-1
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
END:VEVENT


Does anybody know how to troubleshoot this?

Thanks in advance,
David

Typically, the best way to contact me with such problems is through opening an issue on GitHub, but I do notice posts here, too. :slight_smile: Looking at that excerpt, I fail to see how anything interprets that event as anything other than all day on 2022-09-10. Note the line that reads:

DTSTART;VALUE=DATE:20220910

That pretty clearly indicates the event is to start on 2022-09-10. Is this the wrong excerpt? I also see a lot of custom properties in the event, which is usually a good sign of something that’s non-standard. You can send me the whole ics file privately (with any summaries, descriptions, and locations redacted), and we can work on figuring this out more specifically.

Unless, of course, that really is the correct excerpt. In which case, I can only point to RFC 5545, in particular section 3.6.1, and the last example, which specifically points out that since DTEND as a date is not inclusive, in your excerpt above with DTEND set to 20220911, that the event ends on 2022-09-10.

Thanks for your reply and sorry for not having opened an issue on GitHub!

I’ve started another test with an empty calendar.
Here is the complete ics file:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Kopano//11.0.2//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-INTENDEDSTATUS:FREE
CREATED:20220908T213511Z
LAST-MODIFIED:20220908T213511Z
DTSTAMP:20220908T213511Z
DTSTART;VALUE=DATE:20220911
DTEND;VALUE=DATE:20220912
SUMMARY:appointment test 2022-09-12\, all day
PRIORITY:5
CLASS:PUBLIC
UID:
 040000008200E00074C5B7101A82E00800000000800564E4CAC3D801000000000000000001
 00000035A1B8102AFD4AE9AC9D0C575AFC4F57
X-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE:20220908T213519Z
X-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE:20220908T213519Z
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-OWNERAPPTID:-1
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
END:VEVENT
END:VCALENDAR

The all day event was created with Kopano WebApp for 2022/09/12 and is correctly shown there.
It is also correctly synchronized to my iPhone via z-push / ActiveSync.

I can confirm that all timezones (Debian / MariaDB / z-push / Kopano) are properly set to “Europe/Berlin”.

Thanks for your help and best regards,
David

Thanks for the reply, and the more information. As earlier, that ICS file clearly indicates the start date of the event is 2022/09/11, not 2022/09/12. If you’re viewing it on your iPhone via z-push/ActiveSync, then my guess is that Kopano doesn’t natively store the data in ICS format. ActiveSync doesn’t use ICS to exchange data, so if it’s right on your server, then it makes sense that anything which gets the data via ActiveSync will also be correct. I think Kopano has a bug when it generates the ICS file. :frowning: In a quick look, I do see some references to Kopano & CalDAV. Normally, I recommend using CalDAV because it’s more efficient (and moves most of the work onto the server). In this case, though, it’s important to note that CalDAV does use ICS, so the chances are that it wouldn’t help. If you can report the problem, and want somebody who can reference the RFCs to say that what was produced is wrong, I’d be happy to do that. I’m sorry I can’t fix the issue, though.

Thanks for your support and your kind offer!

Your explanation seems absolutely sensible to me.
There is a Kopano community forum where I’ve opened a thread:
Kopano Community Forum

There is also a plugin called “Kopano kDAV” (kDAV) that is based on SabreDAV and adds CalDAV and CardDAV to Kopano. I’ve already installed it, but that strange behaviour also happens with kDAV and not only with the iCal interface that is built-in into Kopano server…

1 Like

Unfortunately, I didn’t get any response to my Kopano GitHub issues until today.

But I made an interesting observation:
I recently set up a Univention server (open source) which also contains a free Kopano Groupware setup in its AppStore that does not show the observed ical bug.

I compared the Kopano settings to those of my “hand-built” server and couldn’t find any differences concerning configuration or timezone settings. Still, the Kopano version offered by Univention is older than the one I got from the Kopano community sources.

As nobody related to Kopano was willing to answer my requests, I decided to switch to the Univention platform. I will move my AD controller and my email server to that one in the next days and have another test run afterwards.

I will report my findings when it’s finished.
Tom, thanks for your kind support concerning this issue!

For the record. I have been able to successfully add calendars from Webcal Guru for official holidays and flag days.

Is there a way to import an ICS calendar into an existing google calendar rather than creating a new calendar?

I use an ICS calendar provided by my work scheduling tool for my shifts. My issue is that the events imported from the ICS calendar aren’t kept once “today” passes. My ICS calendar provides shift schedules for 3 weeks in adavance from this weeks current Monday. When the ICS calendar rolls over to next Monday and the ICS calendar is updated then the past weeks shift schedules are no longer displayed on the calendar. Hopefully that makes sense.

I’d like to import the ICS calendar to allow them to be static ie. still exist after the ICS calendar has been updated.

Hopefully this post can save someone the time it took me to figure this out.

To get the link for a Family Wall calendar, open the calendar page, and on the right side of the screen, click the arrow on the right side of the calendar you want to add. That will let you create a sharing link. It’s an iCal file, so you’ll need to add the iCal integration not the ics one.

2 Likes

The https://www.home-assistant.io/integrations/local_calendar/stores an .ics file underneath for what it’s worth. You may be able to clobber it with your own file and see what happens. (It does not support import /yet/)

Hello,
i installed the custom component via HACS.
After that i added this to my configuration.yaml

ics_calendar:
  calendars:
    - name: "Feiertage (Sachsen)"
      url: "http://i.cal.to/ical/51/sachsen/feiertage/dd7b6116.ed5153b5-0c527e40.ics"

If i click check configuration files on the developer site, the wheel is spinning infinite. Without the code above i get a success message.

Any idea what the problem could be?

Don’t know what the problem was. It works now.