Multiple planned calender events in Google agenda don't trigger the automation

Hi Everyone,

I’m trying out my first automations and already got some fun results!

But I’m having trouble with the automation that informs me on my phone to put the trash out (based on an Google event).

The Yaml code:

id: 'id'
alias: Trash Notification
description: ''
trigger:
  - platform: calendar
    event: start
    offset: '-5:0:0'
    entity_id: calendar.*email*
    variables:
      eventname: '{{ trigger.calendar_event.summary }}'
condition:
  - or:
      - condition: template
        value_template: '{{ ''GFT'' in trigger.calendar_event.summary }}'
      - condition: template
        value_template: '{{ ''PMD'' in trigger.calendar_event.summary }}'
      - condition: template
        value_template: '{{ ''GLAS'' in trigger.calendar_event.summary }}'
      - condition: template
        value_template: '{{ ''PAPIER'' in trigger.calendar_event.summary }}'
      - condition: template
        value_template: '{{ ''RESTAFVAL'' in trigger.calendar_event.summary }}'
      - condition: template
        value_template: '{{ ''GROFVUIL'' in trigger.calendar_event.summary }}'
action:
  - device_id: *device id*
    domain: mobile_app
    type: notify
    message: Put {{ eventname }} out
    title: Trash collection
mode: single

Goal: The planned event is a day event in the google calendar with only an title (e.g.: PMD). 5 hours before the start (19h in the evening) a message is send for each event (that matches the conditon) to my phone telling me what trash I need bring out.

Issue: If only 1 event is planned, the automation works and the message containts the variable text. But if 2 or more events are planned (E.g.: PDM and GFT), nothing happens.
Trace shows this:


It false for all the conditions.
I can solve this by making multiple automations for each trash type, but I want to see if I can make it cleaner first.

Let me know if I’m doing something wrong or if there are other ways.

If there are two Calendar events scheduled for the same time, the automation’s Calendar Trigger would trigger twice. However, your automation’s mode is single so it would only be able to process the first of the two triggers (it will ignore the second one because it’s still busy processing the first one).

I suggest you change the value of mode to queued.

Reference

Script Modes

Thanks, that indeed sloved the issue!

1 Like