Automation that checks google calendar for certain pattern

Hello all,

still got problems writing the correct automation.

I’d like to have a triggered automation, that checks for a matching
entry in the google calendar integration.

I’m currently at the following point

alias: testcalendar
description: ""
trigger:
  - platform: time
    at: "10:26:00"
condition: []
action:
  - service: calendar.get_events
    target:
      entity_id:
        - calendar.schulferien_bayern
    data:
      start_date_time: "{{ today_at('00:00') }}"
      duration:
        hours: 24
        minutes: 0
        seconds: 0
    response_variable: vacationEntries
  - service: notify.mobile_app_sm_a336b
    metadata: {}
    data:
      title: Calendar notification Alarm
      message: Calendar noti

How do I proceed to run the notify.mobile_app_sm_a336b service only if
the vacationEntries matches a certain pattern?

Thanks in advance

Peter

Please describe what you mean by “a certain pattern”.

Hi,
I verified that vacation response holds the calendar entries for today.
I’d like to run the notification service if one of these entries matches a string e.g. “*holiday”.

Peter

Assuming by “entries” you mean the title/summary of the event:

alias: testcalendar
description: ""
trigger:
  - platform: time
    at: "10:26:00"
condition: []
action:
  - service: calendar.get_events
    target:
      entity_id:
        - calendar.schulferien_bayern
    data:
      start_date_time: "{{ today_at('00:00') }}"
      duration:
        hours: 24
        minutes: 0
        seconds: 0
    response_variable: vacationEntries
  - condition: template
    value_template: |
      {% set events = vacationEntries['calendar.schulferien_bayern'].events %}
      {{ events | selectattr('summary', 'match', '\*holiday') | list | count > 0 }}
  - service: notify.mobile_app_sm_a336b
    metadata: {}
    data:
      title: Calendar notification Alarm
      message: Calendar noti

Thanks very much, I’ll give a try and provide feedback

Hi,
thanks for support, I finally made it, only the regular expression didn’t work.

It should match ‘.*holiday’.

Step by step getting more experience.

Thanks again

Peter