Calendars have been a somewhat neglected function, but that has been improving recently. For Google calendars you can use the Hass Calendar Addon to create a sensor that exposes an array of events. For Local Calendar there’s a “hack” to get the data via REST.
But you can accomplish the goal without using either of those option. You could use template binary sensors triggered by you calendar events.
template:
- trigger:
- platform: calendar
event: start
entity_id: calendar.school_calendar
- platform: time
at: "23:59"
binary_sensor:
- name: School Day Cal
state: >
{% set current = this.state %}
{% if trigger.platform == 'time' %} off
{% elif trigger.platform == 'calendar' %}
{{ iif(trigger.calendar_event.summary == "SchoolDay", 'on', current) }}
{% endif %}
- trigger:
- platform: calendar
event: start
entity_id: calendar.family
- platform: time
at: "23:59"
binary_sensor:
- name: School Day Family
state: >
{% set current = this.state %}
{% if trigger.platform == 'time' %} on
{% elif trigger.platform == 'calendar' %}
{{ iif(trigger.calendar_event.summary == "NoSchool", 'off', current) }}
{% endif %}
Then you would put those sensors in the conditions instead of the calendar states.
...
condition:
- alias: "School Calendar says it's a school day"
condition: state
entity_id: binary_sensor.school_day_cal
state: 'on'
- alias: "Family Calendar says it's a school day"
condition: state
entity_id: binary_sensor.school_day_family
state: 'on'
- alias: "Not Saturday or Sunday"
condition: template
value_template: "{{ now().isoweekday() < 6 }}
...
EDIT: Removed double-negative in second sensor