the only concerned i had is when my kids have a holiday event on the calendrer like spring break and winter break. will the calendrer keep the toggle on until the last day of the event or do i have to tweak the event end part to -20 also? Example would be my kids winter break when they are out of school for a week?
Yes. The Input Button will be turned on 20 hours before the start of Winter Break and turned off at the end of Winter Break.
Thank you that’s what I wanted.
Are ‘Staff Development Day’ and ‘Teacher Work Day’ also part of calendar.kids_school
and do you want the Input Button to be turned on 20 hours before the start of those events?
question? how do i exclude days like (parent/ teacher conference and testing day)?
Do you want the Input Button to be turned on 20 hours before the start of 'Staff Development Day’ and ‘Teacher Work Day’ or do you want to exclude those events?
Keep those, its the parent teacher conference and test days i want to exclude, due to my kids will still be going to school those days.
To selectively include (or exclude) events is by searching for specific words in the event’s name.
For example, you can include events whose name contains the word “Break”. However, this will only work correctly if the events have a consistent naming scheme. For example, it will include “Winter Break” but exclude “Spring Recess” because it doesn’t contain the word “Break”. In that case, it would need to search for event names containing “Break” or “Recess”.
I view that “parent” and “testing” are the only ones with those names. They would be the only one excluded
If you only exclude events whose names contain the words “parent” or “testing”, then “Staff Development Day” and “Teacher Work Day” will be included because they don’t contain those words.
That’s why I suggested you indicate what words are found in the names of the events you want to include (not exclude). For example, we know you want to include events whose name contains “Break”. Are there other words, perhaps “Holiday”?
Oh ok So I would include the words that dont begin with “Parent” and “testing”. How would I accomplish that?
Include, “Staff” “Break” “Good”, The holidays all end with “Day” But testing ends with “Days” Would that be a issue?
You must specify the words that can exist in the event names you want to include. For example, the word “Break” (because it is in “Winter Break”). Look at the calendar and examine the names of all the events you want to include. Identify common words they contain.
Would I specify using a template?
The following example turns on the Input Boolean 20 hours before the event but only for events whose name contains “Break” or “Holiday”. It also turns off the Input Boolean when the event ends.
alias: School Calendrer Toggle
description: ""
trigger:
- platform: calendar
event: start
offset: "-20:0:0"
entity_id: calendar.kids_school
id: 'on'
alias: Kids Start
- platform: calendar
event: end
offset: "0:0:0"
entity_id: calendar.kids_school
id: 'off'
alias: Kids End
condition:
- condition: template
value_template: "{{ trigger.calendar_event.summary is search('(Break|Holiday)') }}"
action:
- service: 'input_boolean.turn_{{ trigger.id }}'
target:
entity_id: input_boolean.kids_school_helper
mode: single
alias: School Calendrer Toggle
description: ""
trigger:
- platform: calendar
event: start
offset: "-20:0:0"
entity_id: calendar.kids_school
id: Kids start
alias: Kids Start
- platform: calendar
event: end
offset: "0:0:0"
entity_id: calendar.kids_school
id: Kids End
alias: Kids End
condition:
- condition: template
value_template: >-
{{ trigger.calendar_event.summary is
search('(Break|Holiday|Day|Good|Staff)') }}
action:
- choose:
- conditions:
- condition: trigger
id:
- Kids start
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.kids_school_helper
- conditions:
- condition: trigger
id:
- Kids End
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.kids_school_helper
mode: single
I assume you understand that by adding the word Day
here:
search('(Break|Holiday|Day|Good|Staff)')
It means it will include these events that you originally said you wanted to exclude:
- Staff Development Day
- Teacher Work Day
Yes correct because those are the days they will be out of school.
In that case, your automation will not correctly set the Input Boolean when it encounters consecutively scheduled events.
Staff Development Day is scheduled immediately after Winter Break which means the Input Boolean will be turned on 20 hours before Staff Development Day and then turned off at 00:00
when Winter Break ends and Staff Development Day officially begins. That’s incorrect because the Input Boolean should be left on throughout Staff Development Day.
Your automation will need an additional Calendar Trigger set for the start of an event but offset by a few seconds.
alias: School Calendrer Toggle
description: ""
trigger:
- platform: calendar
event: start
offset: "-20:0:0"
entity_id: calendar.kids_school
id: 'on'
alias: Before Kids Start
- platform: calendar
event: start
offset: "0:0:5"
entity_id: calendar.kids_school
id: 'on'
alias: Kids Start
- platform: calendar
event: end
offset: "0:0:0"
entity_id: calendar.kids_school
id: 'off'
alias: Kids End
condition:
- condition: template
value_template: >
{{ trigger.calendar_event.summary is search('(Break|Holiday|Day|Good|Staff)') }}"
action:
- service: 'input_boolean.turn_{{ trigger.id }}'
target:
entity_id: input_boolean.kids_school_helper
mode: single