Case insensitive calendar summary search

Apologies if this has been answered before, but I’m not seeing relevant results when I search for previous topics.

I have a number of dashboard buttons which light up depending on the existence of various Google calendar entries. In general, it works perfectly, but I’m having an issue with one calendar which I’m not in control of.

My son’s Cub Scout group has a public-facing calendar feed, which lists the evening meeting each Tuesday. Alas, it also has an entry for the Tuesday over school half term which reads “NO MEETING”. Or sometimes “No Meeting”. :roll_eyes:

condition: and
conditions:
  - condition: template
    value_template: |-
      {{
        agenda['calendar.cubs_programme'].events
          | map(attribute='summary')
          | list
          | count > 0
      }}
  - condition: template
    value_template: |-
      {{
        agenda['calendar.cubs_programme'].events
          | map(attribute='summary')
          | select('search', 'NO MEETING')
          | list
          | count == 0
      }}

This condition serves to screen out the “NO MEETING” occurrence, and I can see how I could add another condition to cope with “No Meeting”.

But I’ve been trying to pipe to lower at some stage so I can have just one condition which will handle any other combinations of capitalisation, and I can’t figure out where to put it, if indeed it’s doable.

Experimenting in the template editor would suggest that I can “lower” the whole events result, but then the map returns an array of Undefined which can’t be processed further.

{% set agenda = {"calendar.cubs_programme":{"events":[{"start":"2025-10-28T18:30:00+00:00","end":"2025-10-28T20:00:00+00:00","summary":"NO MEETING - HALF TERM"}]}} %}

{{
  agenda['calendar.cubs_programme'].events
    | lower
    | map(attribute='summary')
    | list
}}

Any help would be appreciated.

1 Like

You’re applying lower to a list of dictionaries, but it can only work on a string.

You can map the lower filter to a list of strings, which you get after your current map call. So:

{% set agenda = {"calendar.cubs_programme":{"events":[{"start":"2025-10-28T18:30:00+00:00","end":"2025-10-28T20:00:00+00:00","summary":"NO MEETING - HALF TERM"}]}} %}

{{
  agenda['calendar.cubs_programme'].events
    | map(attribute='summary')
    | map('lower')
    | list
}}
2 Likes

This worked for me. TYVM.

The search test has an “ignore case” arg that is false by default, you can set it to true in the select filter as follows:

| select('search', 'NO MEETING', true)

2 Likes

Wow, two solutions! Thanks for the prompt responses, @d921 and @Didgeridrew. I’m marking @Didgeridrew’s as the solution purely since it’s a simpler tweak but it’s great to know there are a couple of ways of doing it.