Google calendar example

Hi, I have a working Google calendar integration.
In the calendar I have several topics like:
“wast green”, “wast yellow”, “birthday tom”, “birtday mary”
I would like to have 2 automations which triggers on “wast *” and “birthday *”.


In the automation I can add a text in “to” but I think “birthday” will not lead to a trigger for “birthday tom”.
Can somebody give me a hint ? I did not find an example for this problem.

If there is a solution: Would it be possible to get access to the complete message of the trigger in the action ? e.g. to send a text like “Info: ‘birthday tom’” ?

Thank you
Peter

Use a Calendar trigger for calendar events… not a State trigger.

You can access the information from the calendar event using Trigger variables. There is an example in the Calendar Automation Recipes

@Didgeridrew thank you, this was the right hint.

After much debugging I got meanwhile the working solution.

Here my snippet out of the file automations.yaml. Maybe it could be helpfule for someone else.

Preconditions:

  • Calender named “fhem”
  • Events in the calendar with “Mülltonne” in the title (eg.: “Mülltonne Blau”)
  • Telegram integration
  • status LED which can have different colors and “off”

This automation will only activated if the text “Mülltonne” is in the title. All other events will be ignored.
I think that this automation only works for the first active event.
Example:
04.02.2023 14:00 - 18:00 Holiday
04.02.2013 15:00 - 16:00 Mülltonne Blau
Will not trigger this automation because the state of the calendar did not change while the holiday evejt is ongoing.

At the begin of the event:

  • a telegarm message is sent with the complete title of the event
  • a LED is switched to the color “RED”
    At the end of the event:
  • the same LED is switched off
- id: MuelltonnenRausAutomation
  alias: MuelltonnenRaus
  description: Benachrichtigt wenn die Mülltonnen raus müssen
  trigger:
    - platform: calendar
      event: start
      offset: 0:0:0
      entity_id: calendar.fhem
    - platform: calendar
      event: end
      offset: 0:0:0
      entity_id: calendar.fhem
  condition:
    - condition: template
      value_template: "{{ 'Mülltonne' in trigger.calendar_event.summary }}"
  action:
    - if:
        - "{{ trigger.event == 'start' }}"
      then:
        - service: telegram_bot.send_message
          data:
            message: "{{ trigger.calendar_event.summary }}"
        - service: select.select_option
          data:
            option: RED
          target:
            entity_id: select.dl_statusled_led_status_ch16
      else:
        - service: select.select_option
          data:
            option: "OFF"
          target:
            entity_id: select.dl_statusled_led_status_ch16
  mode: parallel
  max: 2

I started to create the automation in the UI:

I did not find a way to generate the trigger as shown here in the UI and added it later in the YAML file