I have a calendar, calendar.town_schools
, in Home Assistant. Every event on the calendar is an all day event lasting one or more days. For the purposes of this sensor, I only care about events with the titles:
- No School
- Last Day of School
- First Day of School
I want a school_day
binary sensor with the following logic:
- If it’s a weekend then the sensor is
off
- If there’s a “No School” event, the sensor is
off
- If the current date is >
Last Day of School
this year and <First Day of School
this year, the sensor isoff
(for summer vacation) - Otherwise, the sensor is
on
.
The calendar, which I import from the school district, does not explicitly list summer vacation days or weekends as having “No School” and I’d very much like to avoid explicitly adding that.
I see examples of how to handle "if today has this specific event, turn the sensor on`, but can’t figure out how to handle the detection of summer vacation.
Any pointers?
1 post - 1 participant