Add support for K's new after school program

This commit is contained in:
2023-10-13 19:29:40 -04:00
parent e5f31a6383
commit 6eadb395e1
7 changed files with 51 additions and 3 deletions

View File

@ -425,6 +425,9 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
'But there was a two hour delay. ' 'But there was a two hour delay. '
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if is_state('input_boolean.kallen_btb','on') %}
Collin has Beyond The Bells today after school.
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') %}
{{ states('input_text.kallen_pickup') }} will be picking Collin up from school today. {{ states('input_text.kallen_pickup') }} will be picking Collin up from school today.
{% else %} {% else %}
@ -490,6 +493,9 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
School is currently under a two hour delay. School is currently under a two hour delay.
{% elif is_state('input_boolean.kallen_at_school','on') %} {% elif is_state('input_boolean.kallen_at_school','on') %}
{{ identKallen }} is at school right now. {{ identKallen }} is at school right now.
{% if is_state('input_boolean.kallen_btb','on') %}
{{ identKallen }} has Beyond The Bells after school today.
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') %}
{{ states('input_text.kallen_pickup') }} will be picking him up from school today. {{ states('input_text.kallen_pickup') }} will be picking him up from school today.
{% elif is_state('input_boolean.kallen_school_early_release','on') %} {% elif is_state('input_boolean.kallen_school_early_release','on') %}
@ -508,6 +514,9 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endif %} {% endif %}
{% elif is_state ('binary_sensor.early_night_mode','on') and is_state('binary_sensor.kallen_school_tomorrow','on') %} {% elif is_state ('binary_sensor.early_night_mode','on') and is_state('binary_sensor.kallen_school_tomorrow','on') %}
{{ identKallen }} has school tomorrow. {{ identKallen }} has school tomorrow.
{% if is_state('binary_sensor.kallen_btb_tomorrow','on') %}
{{ identKallen }} will have BTB tomorrow after school.
{% endif %}
{% elif is_state('binary_sensor.after_midnight','off') %} {% elif is_state('binary_sensor.after_midnight','off') %}
{{ identKallen }} does not have school today. {{ identKallen }} does not have school today.
{% endif %} {% endif %}

View File

@ -407,7 +407,7 @@ script:
time: > time: >
{% from 'time.jinja' import time_from_calendar %} {% from 'time.jinja' import time_from_calendar %}
{% if is_state('input_boolean.kallen_school_today','on') %} {% if is_state('input_boolean.kallen_school_today','on') %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') or is_state('input_boolean.kallen_btb','on') %}
15:00 15:00
{% else %} {% else %}
{{ time_from_calendar('calendar.kallen_school_days','end_time','set','subtract',1) }} {{ time_from_calendar('calendar.kallen_school_days','end_time','set','subtract',1) }}
@ -550,7 +550,7 @@ script:
data: data:
time: > time: >
{% if is_state('input_boolean.kallen_school_today','on') %} {% if is_state('input_boolean.kallen_school_today','on') %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') or is_state('input_boolean.kallen_btb','on') %}
14:30 14:30
{% elif is_state('input_boolean.kallen_school_early_release','on') %} {% elif is_state('input_boolean.kallen_school_early_release','on') %}
12:00 12:00

View File

@ -14,6 +14,9 @@ input_boolean:
kallen_school_today_extended: kallen_school_today_extended:
name: Kallen School Today Extended name: Kallen School Today Extended
icon: mdi:bus-school icon: mdi:bus-school
kallen_btb:
name: Kallen BTB
icon: mdi:bus-clock
two_hour_delay: two_hour_delay:
name: Kallen Two Hour Delay name: Kallen Two Hour Delay
icon: mdi:bus-clock icon: mdi:bus-clock
@ -85,6 +88,11 @@ template:
off off
{% endif %} {% endif %}
icon: mdi:school icon: mdi:school
- name: Kallen BTB Tomorrow
unique_id: 68d8eb9c-d96c-4c76-a8e8-23125f1162db
state: >-
{%- set test=(as_timestamp(now()) + (86400)) | timestamp_custom("%Y-%m-%d",true) %}
{{ states.calendar.kallen_school_days.attributes.end_time == test + " 16:30:00" }}
- sensor: - sensor:
- name: School Start Days2go - name: School Start Days2go
unique_id: 94a53e67-c00f-4cc7-9309-f9033a9482f9 unique_id: 94a53e67-c00f-4cc7-9309-f9033a9482f9
@ -326,6 +334,7 @@ automation:
- input_boolean.kallen_at_school - input_boolean.kallen_at_school
- input_boolean.kallen_alternate_pickup - input_boolean.kallen_alternate_pickup
- input_boolean.kallen_school_early_release - input_boolean.kallen_school_early_release
- input_boolean.kallen_btb
- delay: - delay:
seconds: 2 seconds: 2
- service: script.rerun_all_scheduling_morning - service: script.rerun_all_scheduling_morning
@ -365,6 +374,16 @@ script:
{% else %} {% else %}
{{ time_from_calendar('calendar.kallen_school_days','start_time','set') }} {{ time_from_calendar('calendar.kallen_school_days','start_time','set') }}
{% endif %} {% endif %}
- if:
- condition: template
value_template: >
{% from 'time.jinja' import time_from_calendar %}
{% set cal = time_from_calendar('calendar.kallen_school_days','end_time','read') | trim %}
{{ cal == '4:30 PM' }}
then:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.kallen_btb
- service: input_boolean.turn_on - service: input_boolean.turn_on
entity_id: entity_id:
- input_boolean.kallen_school_today - input_boolean.kallen_school_today
@ -388,3 +407,4 @@ script:
entity_id: entity_id:
- input_boolean.kallen_school_today_extended - input_boolean.kallen_school_today_extended
- input_boolean.kallen_school_early_release - input_boolean.kallen_school_early_release
- input_boolean.kallen_btb

View File

@ -91,6 +91,9 @@
{% if is_state('binary_sensor.raining','on') %} {% if is_state('binary_sensor.raining','on') %}
It appears to be raining right now, so you might get wet on your way to school. It appears to be raining right now, so you might get wet on your way to school.
{% endif %} {% endif %}
{% if is_state('input_boolean.kallen_btb','on') %}
You have Beyond The Bells today after school.
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') %}
Today, you will be picked up from school by {{ states('input_text.kallen_pickup') }}. Today, you will be picked up from school by {{ states('input_text.kallen_pickup') }}.
{% elif is_state('input_boolean.work_today','off') %} {% elif is_state('input_boolean.work_today','off') %}

View File

@ -19,6 +19,12 @@
'Because you have to get up early tomorrow for school.', 'Because you have to get up early tomorrow for school.',
'Because you want to be ready for school tomorrow.' 'Because you want to be ready for school tomorrow.'
] | random }} ] | random }}
{% if is_state('binary_sensor.kallen_btb_tomorrow','on') %}
{{ [ 'You have Beyond The Bells tomorrow after school. ',
'You will be staying a little later after school tomorrow to further your learning endeavors. ',
'Tomorrow is a BTB day. '
] | random }}
{% endif %}
{% else %} {% else %}
{% set month=states("sensor.date").split('-')[1] | int %} {% set month=states("sensor.date").split('-')[1] | int %}
{%- if is_state('input_boolean.school_in_session', 'off') -%} {%- if is_state('input_boolean.school_in_session', 'off') -%}

View File

@ -23,6 +23,9 @@
{% if is_state('input_boolean.kallen_school_early_release','on') %} {% if is_state('input_boolean.kallen_school_early_release','on') %}
"There will be early dismissal today. " "There will be early dismissal today. "
{% endif %} {% endif %}
{% if is_state('input_boolean.kallen_btb','on') %}
"You have Beyond The Bells today after school. "
{% endif %}
"Your school day will end at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. " "Your school day will end at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. "
{% endif %} {% endif %}
</p> </p>

View File

@ -41,6 +41,13 @@
'Do not forget to do your homework! ', 'Do not forget to do your homework! ',
'You must be glad that your school day is over! ' 'You must be glad that your school day is over! '
] | random }} ] | random }}
{% if is_state('input_boolean.kallen_btb','on') %}
{{ [
'I hope you enjoyed BTB today. ',
'I bet you are exhausted after a couple of extra hours at school. ',
'It is my sincere hope that your extra learning today was enjoyed to the fullest! '
] | random }}
{% endif %}
{% elif is_state('input_boolean.school_cancelled','on') and is_state('person.kallen_stork','home') %} {% elif is_state('input_boolean.school_cancelled','on') and is_state('person.kallen_stork','home') %}
"I hope you are enjoying your free day off from school, Collin. " "I hope you are enjoying your free day off from school, Collin. "
{% endif %} {% endif %}