home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.71k stars 30.84k forks source link

CalDav: Repeat events do not show in all views #40127

Closed bverkron closed 1 year ago

bverkron commented 4 years ago

The problem

Repeat calendar events do not show beyond the first entry in Monthly and Weekly views. They do, however, render as expected in Daily view. Seems to happen with CalDav but not Google Calendar entries. Might be specific to iCloud calendars, not sure, don't have another CalDav compatible calendar to test with.

Environment

Problem-relevant configuration.yaml

calendar:
  - platform: caldav
    username: !secret icloud_username
    password: !secret icloud_app_password
    url: https://caldav.icloud.com
    calendars:
      - Family
      - Errands

Traceback/Error logs

N/A

Additional information

In the monthly and weekly view you can see only a single event (the first one). But moving forward to the 17th (or any day beyond the first one) you can see the repeat events.

monthly weekly daily
probot-home-assistant[bot] commented 4 years ago

caldav documentation caldav source (message by IssueLinks)

alkern commented 4 years ago

Might be specific to iCloud calendars, not sure, don't have another CalDav compatible calendar to test with.

I have the same problem with the Radicale CalDAV server.

In addition to the Calendar view it also happens in the custom calendar card

bverkron commented 4 years ago

Issue still present in 0.115.1 in both places (Calendar side panel and Calendar Card).

jmillnik commented 4 years ago

Issue happens to me for Google Calendar events as well. Present in calendar side panel and calendar card.

More specifically, from calendar side panel view, clicking on a date in the calendar loads the day without events showing. Clicking the next (or previous) button and then navigating back to the date does display the event information.

So the events are known but simply don't appear on all views.

asdrolf commented 3 years ago

Have the same issue with Caldav Nextcloud calendar with recurring events.

elliottjohnson commented 3 years ago

I have the same issue using Baikal Caldav server. Just figured out why Baikal wasn't allowing it to connect https://github.com/sabre-io/dav/issues/1318 and now I'm encountering this issue. I'll look into it some more when I have more time :)

elliottjohnson commented 3 years ago

Looking closer at the UI, I don't see that <div class="fc-daygrid-day-events"> is even populated on calendar days on the month view with the event. There is a ::before and an ::after, but no <div class="fc-daygrid-event-harness"> or subsequent divs for the repeated events.

sandervandegeijn commented 3 years ago

Confirmed for icloud with HA Home Assistant 2021.2.1

A shame, this keeps me from kicking Google out the door.

docsteel commented 3 years ago

Can confirm for HA 2021 3.3 with DaviCal Server 1.1.9.3

Chreece commented 3 years ago

I moved from Google Calendar to Nextcloud and I had the same issue for repeated calendars. I'm mentioning that because it's been said that Google didn't have this issue

jmillnik commented 3 years ago

I don't know who mentioned that google did not have this issue but that is incorrect. Google calendars also specifically have this issue. It has nothing to do with the calendar provider. It's a bug in the way that repeated events are rendered.

If you view a day on the calendar it will sometimes not show the repeat event either but navigating away from and back to the event will display the repeated event.

I have not had an opportunity yet but if no one else fixes this, once I get time from work I will look at where the source of the issue resides and try to get a commit out.

On Fri, Mar 12, 2021, 10:33 AM Chreece @.***> wrote:

I moved from Google Calendar to Nextcloud and I had the same issue for repeated calendars. I'm mentioning that because it's been said that Google didn't have this issue

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/40127#issuecomment-797643106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYFVTAPPPDPNWD62SXJIKDTDJF5HANCNFSM4ROGUGQA .

Chreece commented 3 years ago

Exactly! I have some other problems with CalDav integration, i posted them in another issue https://github.com/home-assistant/core/issues/35654 it is open since 10 months! Let's hope it will be an easy fix and the devs can spend some of their precious time on it...

jmillnik commented 3 years ago

I think this is something that is only replicated if repeat events are set up a certain way and therefore may not be reproducible. If someone creates a public calendar that can be included which demonstrates the issue that may help :-)

On Fri, Mar 12, 2021, 2:30 PM Chreece @.***> wrote:

Exactly! I have some other problems with CalDav integration, i posted them in another issue #35654 https://github.com/home-assistant/core/issues/35654 it is open since 10 months! Let's hope it will be an easy fix and the devs can spend some of their precious time on it...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/40127#issuecomment-797766115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYFVTEUQCXN37AVX7ML3L3TDKBVRANCNFSM4ROGUGQA .

adrkable commented 3 years ago

I'm seeing the same with Radical CalDAV server.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

sandervandegeijn commented 3 years ago

Not stale..

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

docsteel commented 3 years ago

Issue not solved.

marksie1988 commented 3 years ago

I also see this issue with owncloud and users of my calendar card are reporting the same issue

ACiDGRiM commented 3 years ago

This is frustrating because I was hoping to rely on this as an alarm in the morning by setting alarms for Weekdays, Saturdays and Sundays. Repeating events are a standard feature of any calendar, not an edge case.

mathmaniac43 commented 3 years ago

This is frustrating because I was hoping to rely on this as an alarm in the morning by setting alarms for Weekdays, Saturdays and Sundays. Repeating events are a standard feature of any calendar, not an edge case.

I have an automation that fires based on a recurring calendar item (via CalDav), and that works every day. Your alarm should work. The only problem is that the monthly and weekly views don't SHOW the repeated calendar entries, even though they do sync into Home Assistant properly.

ACiDGRiM commented 3 years ago

I've recreated the event series several times, the only event that fires is the first in the series, or repeating events that always occur on the same day

I.e. M-f fires on Monday Saturday repeating fires Sunday fires

After two weeks of being late to work, thankfully it's remote, I've just relegated to node red repeating inject nodes and have the calendar integration just send me a push notification so I can see if it ever starts working.

mathmaniac43 commented 3 years ago

Oh OK! Mine is an every single day at the same time event, so perhaps it just means that if it isn’t daily or weekly or monthly (some other kind of staggered schedule) it gets messed up. That sounds very frustrating.

Basilic commented 3 years ago

Same problem with Radicale server I will automate with a bi-weekly planing, only the first instant is seen in all view (month, week or day)

ACiDGRiM commented 3 years ago

It does look like a multi day repeating event only fires on the first day, i.e. if I have M-F repeating starting on October 1, it only fired on October 1.

If I have a single day repeating event, i.e. every Saturday or another on every sunday, these events fire weekly with no issue.

Also, if I edit a single event, and break it from the series, that fires.

ACiDGRiM commented 2 years ago

I've tried to work with this again and can confirm it is 100% reproduceable using a caldav calendar from nextcloud

1) create repeating event starting on a monday, repeating every weekday, and other events that repeat only on Sunday 2) add calendar into homeassistant 3) review calendars by week 4) notice that the Weekday events repeat EVERY monday and the last day, and not Tue-Thur 5) Sunday single day events, of course repeat every Sunday.

Some improvement to select the days to repeat in this core component is necessary.

mwthrane commented 2 years ago

I have the same issue with google calendars.

ACiDGRiM commented 2 years ago

No improvement, still exhibiting the same issue.

ACiDGRiM commented 2 years ago

https://github.com/home-assistant/core/issues/65941

Here is the cause and solution for next cloud users: nextcloud public subscription links are really just .ics ical files which accidentally worked, but do not fully function with the CalDav parser, apparently, which breaks repeating events. This may also impact icloud where the calendar url is actually an .ics download.

The solution is to use the real CalDav connection at cloud.yoursite.com/remote.php/dav to import all of your calendars. However this may not be ideal because this means saving an app-password or even your main password in the HomeAssistant configuration. My suggested approach is to create an account in Nextcloud (or similar platform) called something like "Assistant" and share your personal calendars you want in HomeAssistant to that account. Then you can turn on TOTP and create an app-password for the Assistant account and use this as the account in homeassistant with limited exposure.

Here's a post in the HA community I made: https://community.home-assistant.io/t/psa-nextcloud-public-shared-calendar-links-stopped-working-on-2022-2-update-because-they-should-have-never-worked/401292

marksie1988 commented 2 years ago

65941

Here is the cause and solution for next cloud users: nextcloud public subscription links are really just .ics ical files which accidentally worked, but do not fully function with the CalDav parser, apparently, which breaks repeating events. This may also impact icloud where the calendar url is actually an .ics download.

The solution is to use the real CalDav connection at cloud.yoursite.com/remote.php/dav to import all of your calendars. However this may not be ideal because this means saving an app-password or even your main password in the HomeAssistant configuration. My suggested approach is to create an account in Nextcloud (or similar platform) called something like "Assistant" and share your personal calendars you want in HomeAssistant to that account. Then you can turn on TOTP and create an app-password for the Assistant account and use this as the account in homeassistant with limited exposure.

Here's a post in the HA community I made: https://community.home-assistant.io/t/psa-nextcloud-public-shared-calendar-links-stopped-working-on-2022-2-update-because-they-should-have-never-worked/401292

Just tested this and recurrences dont show right. I already had my calendar set in this way and I see the first occasion but none after that

ACiDGRiM commented 2 years ago

They still appear to not show up in the calendar when clicking a day until I advance 1 day and then go back, then every day either forward or back shows the repeat events.

I think the more meaningful check is does the calendar binary sensor show on when the event is scheduled? Note it does appear to only trigger nearly 1 minute after the schedule start, so the schedule should be at least 5 minutes long. Instant 0 minute length (08:00-08:00) meetings do not trigger. However this is not the same issue as the repeat calendar events.

TheRealRWJ commented 2 years ago

Issue still persists

RRULE line from CALDAV ICS file is not parsed

RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20220402T215900Z;BYDAY=MO,TU,WE,TH,FR

vincegre commented 2 years ago

+1 on this, no recurring event shows up and full day event too are not showing up in HA :( (whatever NC version used...)

sebPomme commented 2 years ago

+1 , I have the issue with nextcloud and HA 2022.4.6

tobixen commented 2 years ago

I'm the de-facto maintainer of the python caldav library, which is used by the caldav integration.

The python caldav library depends on the server to do expansion of repeating events - unfortunately not all servers supports this. I haven't read all the activity above - but I expect it to correspond with this list:

There is a plan to support expansion client-side, but hard to say when I will get time to fix that.

tobixen commented 2 years ago

Here is the corresponding issue for the caldav library: https://github.com/python-caldav/caldav/issues/157

metronidazole commented 2 years ago

Does anyone else have recurring events not triggering automations (except for first occurrence)?

tobixen commented 2 years ago

Does anyone else have recurring events not triggering automations (except for first occurrence)?

I got it to work ("heat the kitchen prior to breakfast time" was a daily calendar thing during the winter).

If the event is shown in the calendar in HA, then you have most likely found a new bug and should file a new issue for it.

If the event is not shown in the calendar in HA, then this bug is affecting you as well. Then you have the options to change your calendar server, help fixing https://github.com/python-caldav/caldav/issues/157 or wait it out until I get around to implement client-side expansion in the caldav-library, or wait until someone implements client-side expansion in HA :-)

metronidazole commented 2 years ago

Does anyone else have recurring events not triggering automations (except for first occurrence)?

I got it to work ("heat the kitchen prior to breakfast time" was a daily calendar thing during the winter).

If the event is shown in the calendar in HA, then you have most likely found a new bug and should file a new issue for it.

If the event is not shown in the calendar in HA, then this bug is affecting you as well. Then you have the options to change your calendar server, help fixing python-caldav/caldav#157 or wait it out until I get around to implement client-side expansion in the caldav-library, or wait until someone implements client-side expansion in HA :-)

I have this bug (event only shows on all days in daily view, but only first occurrence in monthly/weekly view). However I'm testing with one of the caldav providers which you say expansion works with so...

I've made another event will see what happens.

allenporter commented 2 years ago

For what it's worth, I recently fixed Google Calendar to have the server expand recurring events a few releases ago by passing an extra parameter.

richlawson commented 2 years ago

Hi @allenporter, what extra parameter did you pass?

allenporter commented 2 years ago

I'm saying I fixed Google calendar for everyone. If you see issues with recurring events in Google calendar, then file an issue on the Google calendar integration.

(There is a parameter home assistant passes to the Google calendar API that gets it to expand recurring events)

richlawson commented 2 years ago

I'm still having issues both before and after upgrading to 2022.07. It takes the caldav integration a while to start up, and then I receive a number of errors about skipped events:

2022-07-06 23:49:53 WARNING (SyncWorker_6) [homeassistant.components.caldav.calendar] Skipped event with missing 'vevent' property

Then, right after those repeated messages, the following messages repeat in the logs: 2022-07-06 23:49:46 ERROR (SyncWorker_6) [root] CalDAV server does not support recurring events properly. See https://github.com/python-caldav/caldav/issues/157

This is from my configuration.yaml:

# CalDAV integration.
calendar:
  - platform: caldav
    url: !secret caldav_work_hostname
    username: !secret caldav_work_username
    password: !secret caldav_work_password
    days: 7
    custom_calendars:
      - name: Lunchtime
        calendar: Work
        search: "Lunch"
tobixen commented 2 years ago

The error message about recurring events was thrown into the latest version of caldav. I guess we didn't consider it a potential problem that it would flood error logs.

The contributor of that code even wanted to throw an exception, but I considered that to be a bad idea :-)

The "proper" fix is to change server or nag on your calendar server developers to fix better support for recurring events :-) Or eventually wait for the referenced issue to be fixed (and we'll iron out such problems on the client side)

mck182 commented 2 years ago

If the event is not shown in the calendar in HA, then this bug is affecting you as well. Then you have the options to change your calendar server

I'm running latest Baikal, which is on the list of "supports server expansion", however HA 2022.9.1 does not show recurring events while Apple's Calendar does.

Is Home Assistant supposed to show recurring events with latest Baikal? Or did I misunderstood the list in https://github.com/python-caldav/caldav/issues/157?

tobixen commented 2 years ago

I have on my list that Baikal supports recurring events, but not recurring tasks (but that's probably not what you're interested in). I will try to check again, but I'm not sure if I have any baikal servers to test towards. Could I borrow your server eventually? (See also https://github.com/python-caldav/caldav/issues/45)

daniele-athome commented 2 years ago

Thanks to the huge help from @tobixen we now have client-side expansion in python-caldav! I've already started implementing its use in my own fork: I will submit a PR eventually, after the official release of python-caldav and thorough testing.

allenporter commented 2 years ago

Cool. I wanted to share that Google calendar also does recurring event expansion locally too now and local calendar is in review. As part of adding local calendar I am adding ability to create and delete events in core and the frontend including support for editing recurring events. We should make sure that this can work with caldav too?

tobixen commented 2 years ago

With regard of client side expansion, note that this works for servers that supports recurring events, but does not support expanding the recurring events - so it helps for some servers, but not all.

allenporter commented 2 years ago

@tobixen For servers that do not expand recurring events: do you get back RRULE's from them? If so we could explore sharing this logic https://github.com/allenporter/gcal_sync/blob/c1a511f6e59c5bdd79bafdc4c78dcc6b5d4b5a95/gcal_sync/timeline.py#L112 which i'm now using in ical and gcal_sync to locally expand recurring events in preparation for also supporting mutations. It's a lot more complex, but we could at least share the same bugs :)