Calendar Filter to Switch Boolean

I’d like to have a boolean switch when an event is occurring with text in the title. E.g.

10/16/24-Est. for Karl

I’d like it to turn on when Est is found in that title. I’ve got that figured out this template, but can’t quite wrap my head around handling the situation with multiple overlapping events .

{{ 'Est' in state_attr('calendar.personal_calender', 'message') }}

I’ve been searching and can’t quite figure this one out.

Thanks!

EDIT - To clarify my objective, I would like to be able to use this to trigger automations, and so that I can view the state simply if a type of event is occurring. It won’t always be with a boolean, but that seemed like a simple goal.

This automation is based on what the Calendar docs suggest, and I got it to trigger on my test2 event, however it didnt pass the condition test.

alias: Trigger on Calendar Event
description: ""
triggers:
  - trigger: calendar
    entity_id: calendar.personal_calender
    event: start
    offset: "-0:9:0"
conditions:
  - condition: template
    value_template: "\"{{ 'test2' in trigger.calendar_event.summary }}\""
actions:
  - action: light.toggle
    data: {}
    target:
      entity_id: light.master_fan_lightbulb
mode: single

You have too many quotes. By doing that, the “template” is a string which does not meet the criteria for a template condition.

conditions:
  - condition: template
    value_template: "{{ 'test2' in trigger.calendar_event.summary }}"

Thank you!

That makes sense and I thought that looked funny. I think it happened when I pasted into the visual editor.

That did it.

P.S. Just in time too. I was starting to dive down the hole of a time triggered template in the .yaml files.

@Didgeridrew Just noticed you helped out this one too which is what I was starting to build off. So thanks for the continued help!

Is the approach in this link no longer useful, or is there a case where it makes sense still?

One thing I have learned helping other users on here is that someone will find a use for every possible approach… everyone has their own preferences how they want data sorted, processed, or displayed.

One caveat, there is no point in using such a short time pattern to query for calendar events. The calendars pull events to update every 15 minutes, shorter patterns are just wasting compute resources.

Copy that.

Cheers. :call_me_hand:t3: Thanks for the help and info.

Now my phone will go silent when certain types of calendar events occur, and it will turn back on after they finish. :ok_hand:t3: An annoyance when doing field sales calls.

Here’s one of the automatons I built off the help from Didgeridrew. It turns on a couple of input_booleans that show up on conditional cards on shared dashboards to remind the family whether or not it’s recycling week.

alias: Waste Pickup Service by Calendar
description: ""
triggers:
  - trigger: calendar
    entity_id: calendar.wm_pickup_schedule
    event: start
    offset: "-24:0:0"
    id: Start
  - trigger: calendar
    entity_id: calendar.wm_pickup_schedule
    event: end
    offset: "3:0:0"
    id: End
    enabled: false
conditions: []
actions:
  - if:
      - condition: trigger
        id:
          - Start
      - condition: template
        value_template: "      {{ 'Non-Recyclable Service' in trigger.calendar_event.summary }}"
    then:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.non_recyclable_service
  - if:
      - condition: trigger
        id:
          - Start
      - condition: template
        value_template: "      {{ 'Recyclable Service' in trigger.calendar_event.summary }}"
    then:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id:
            - input_boolean.recyclable_service
mode: queued
max: 10