Getting whole day calendar tasks, but only for tomorrow

Hey hey
For my garbage pickup I created a calendar called “Müll zuhause” and added whole day tasks for every type of garbage pickup. Those are: “Papier”, “gelber Sack”, “Hausmüll”.
I then created the follwoing automation, to give me a telegramm message, when my car arrives home and there is an upcoming garbage event:

alias: Ingeborg kommt nach Hause - Müllbenachrichtigung
description: ""
trigger:
  - platform: zone
    entity_id: device_tracker.ingeborg
    zone: zone.zuhause
    event: enter
condition: []
action:
  - service: calendar.get_events
    target:
      entity_id:
        - calendar.mull_zuhause
    data:
      duration:
        hours: 24
        minutes: 0
        seconds: 0
    response_variable: muellabholung
  - variables:
      events: "{{ muellabholung['calendar.mull_zuhause'].events }}"
  - if:
      - condition: template
        value_template: "{{ events | count > 0 }}"
    then:
      - service: notify.telegrambeide
        data:
          message: |-
            {% for event in events %}{{event.summary}} wird morgen abgeholt
            {% endfor %}
          data:
            disable_notification: false
          title: "*Müllalarm*"
        enabled: true
mode: single

My problem with this is shown in the following example.
Imagine there is a “Hausmüll” pickup tommorrow (So I have this event as a whole day task in my calendar). I then get notified TODAY. But TOMMORROW I will get notified, too, because the task is within the requested 24h range in my automation.
Is there any solution for this (expect changing all my calendar entries)?

Is the Home Feed card any use?

You can set the number of days to look forward.

image

Make your event request specific to tomorrow instead of just now + 24 hours.

...
  - service: calendar.get_events
    target:
      entity_id:
        - calendar.mull_zuhause
    data:
      start_date_time: "{{ today_at('0:01') + timedelta(days=1)}}"
      end_date_time: "{{ today_at('23:59') + timedelta(days=1)}}"
    response_variable: muellabholung
....
1 Like

@Didgeridrew
Thank you man.
This was exactly what I was looking for!