Local Calendar: Is an Event Active? (Condition)

My answer was not an endorsement of Quaec’s sensor configuration…

It sounds like you are using multiple back-to-back all-day events instead of one multi-day event. That could be part of the problem. There will likely be cases where the template presented by Quaec will not work, especially in calendars with concurrent or overlapping events.

Responding services were added in 2023.7 in order to help solve those limitations.

The following is a basic version of such a binary sensor. It fires one minute after midnight every night, gets all the events from a single calendar for the day, and checks if they have “Holiday” in their title/summary.

template:
  - trigger:
      - platform: time
        at: "00:01:00"
    action:
      - service: calendar.get_events
        data:
          start_date_time: "{{ today_at() }}"
          end_date_time: "{{ today_at('23:59:00') }}"
        target:
          entity_id: calendar.YOUR_CALENDAR
        response_variable: agenda
    binary_sensor:
      - name: Is there a Holiday today?
        state: |-
          {% set search_term = "Holiday" %}
          {{ agenda['calendar.YOUR_CALENDAR'].events 
          | selectattr('summary', 'search', search_term) | list | count > 0 }}
1 Like

Thanks @Didgeridrew - didn’t mean to imply that you were endorsing any solution. Just tagged you since you seem like a person that knows what they’re doing!

Will work with this and see where it goes!

Thank you @quaec and users who have helped, this is very useful indeed!