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

all-day events - trigger in HA #74

Open
MPatzek opened this issue Nov 30, 2022 · 5 comments
Open

all-day events - trigger in HA #74

MPatzek opened this issue Nov 30, 2022 · 5 comments
Assignees

Comments

@MPatzek
Copy link

MPatzek commented Nov 30, 2022

Hey,

I have a problem setting up a trigger for all-day events in the automations.
In detail, it is about a trash calender, where the all-day event indicates the day of removal. I tried with a trigger with an offset of 7 hours to trigger it the day before at 5pm.

alias: Kalendertest
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "-7:0:0"
    entity_id: calendar.abfallcalender
condition: []
action:
  - service: telegram_bot.send_message
    data:
      message: Müll wird abgeholt {{ trigger.calendar_event.summary }}
mode: single

Here is the definition:

calendar:
  - platform: ics_calendar
    calendars:
      - name: "Abfallcalender"
        url: "https://calendar.google.com/calendar/ical/xxxxx
        days: 14
        download_interval: 5
        include_all_day: True

The events are shown in the calender tile, but the triggering is not working.
What do I miss here?

best regards

@franc6
Copy link
Owner

franc6 commented Dec 6, 2022

I'm not sure why that wouldn't work, although I suspect it's not related to this calendar platform. I'd recommend changing the automation's mode from 'single' to 'queued', based on recommendations at https://www.home-assistant.io/integrations/calendar#automation

Another note, if this is a trash calendar, I suspect it's unlikely to change often, in which case, you might want to set download_interval to at least 1440 (once a day), instead of 5 (once every 5 minutes). That'll reduce your system load, as it won't have to download the calendar data so often. The download_interval should always be a multiple of 15, anyway, just because of how calendars work in HA.

@MPatzek
Copy link
Author

MPatzek commented Dec 7, 2022

Thanks for the suggestion!
It actually works with "normal" entries, e.g., with a given time of the day. That's why I am confused it does not work with all-day events.
I'll see if it works with the queued mode and report back.

Report back: This did not solve the issue for me. Really weird, since the all-day events are also associated with a exact starting time (00:00). I changed my calender entries not to a given time slot as a work around.

@franc6
Copy link
Owner

franc6 commented Feb 7, 2023

I'm going to leave this open for now, but I don't think this is a bug in this software. I'll play with it for caldav, and see what I can come up with. Please note that all-day events don't actually have a start time; they only have a start date. Usually that's interpreted as 00:00:00, but I wonder if the trigger doesn't interpret the time?

@franc6 franc6 self-assigned this Feb 7, 2023
@SirGarnet
Copy link

SirGarnet commented Mar 30, 2023

Hi @franc6 ,

I have the exact same problem in the current version of HA & ICS Calendar. I add my config and automation, these are working on a local calendar but not with ICS. You can use the appended calendar it is a free suppplied waste calendar for my region.

Maybe this helps to find a solution.

EDIT: Just saw that the whole day events in the downloaded calendar are shown as timed events with a dot and not with a bar like the whole day entrys in a local calendar. See attached image, blue is local calender purple is the ics downloaded calendar.

2023-03-31 00_29_44-Kalender – Home Assistant

configuration.yaml:

# Waste Calendar
calendar:
  - platform: ics_calendar
    calendars:
      - name: "Waste Calendar"
        url: "https://landkreis-stendal.abfall-app.net/download?system=ical&period=1&district=1358&categories=&view=year"
        download_interval: 43800

automation:

alias: TEST - MÜLL
description: Sendet eine Benachrichtigung um die Mülltonnen rechtzeitig raus zu stellen.
trigger:
  - platform: calendar
    event: start
    offset: "-10:0:0"
    entity_id: calendar.waste_calendar
condition: []
action:
  - service: persistent_notification.create
    data:
      message: "{{ trigger.calendar_event.summary }}"
  - service: notify.administrator
    data:
      data:
        inline_keyboard:
          - 30 Minuten:/30m, 1 Stunde:/1h
          - Wird gemacht:/removekeyboard
      message: "{{ trigger.calendar_event.summary }}"
mode: queued

@michaelwingender
Copy link

Looks like I have found a similar issue with a ICS holiday calendar: http://i.cal.to/ical/61/nrw/feiertage/7309dfd4.2383d769-22a4152c.ics
For a local calendar with all day events, automations are triggerd. For this calendar it looks like the events do not trigger my automations.

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

4 participants