From b37108eef5cc8fa9be0907b6fac1c50fae86cb09 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 1 Jun 2023 01:06:35 -0400 Subject: [PATCH] Various fixes because uh oops, end of school year stuff exists --- custom_templates/status.jinja | 41 ++++++++++++++++++----------------- packages/school.yaml | 24 +++++--------------- 2 files changed, 26 insertions(+), 39 deletions(-) diff --git a/custom_templates/status.jinja b/custom_templates/status.jinja index 562c1a6..42805cf 100644 --- a/custom_templates/status.jinja +++ b/custom_templates/status.jinja @@ -260,31 +260,32 @@ Tony does not have a stream scheduled today. The next scheduled stream is in {{ {% if count_the_days('input_datetime.school_last_day') | int == -1 -%} Today is the first day of Summer Break! {%- endif %} - {% elif method == 'text' %} - {% if is_state('input_boolean.kallen_school_today','on') %} - {% if is_state('input_boolean.two_hour_delay','on') %} - School is currently under a two hour delay for Kallen. - {% elif is_state('input_boolean.kallen_at_school','on') %} - Kallen is at school right now. - {% if is_state('input_boolean.kallen_alternate_pickup','on') %} - {{ states('input_text.kallen_pickup') }} will be picking him up from school today. - {% elif is_state('input_boolean.kallen_school_early_release','on') %} - The school is on an early release schedule, pickup is at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }} today. + {% if is_state('input_boolean.school_in_session','on') %} + {% if is_state('input_boolean.kallen_school_today','on') %} + {% if is_state('input_boolean.two_hour_delay','on') %} + School is currently under a two hour delay for Kallen. + {% elif is_state('input_boolean.kallen_at_school','on') %} + Kallen is at school right now. + {% if is_state('input_boolean.kallen_alternate_pickup','on') %} + {{ states('input_text.kallen_pickup') }} will be picking him up from school today. + {% elif is_state('input_boolean.kallen_school_early_release','on') %} + The school is on an early release schedule, pickup is at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }} today. + {% else %} + His pickup time is {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }} today. + {% endif %} {% else %} - His pickup time is {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }} today. + Kallen has school at {{ input_datetime_12hr('input_datetime.kallen_school_day_start') }} today. + {% endif %} + {% elif is_state('input_boolean.school_cancelled','on') %} + School is cancelled today for Kallen. + {% elif is_state('input_boolean.kallen_school_today_extended','on') and is_state('input_boolean.kallen_school_today','off') %} + {% if (ct > wakeup) and (ct < bedtime) %} + Kallen has finished his school day. {% endif %} {% else %} - Kallen has school at {{ input_datetime_12hr('input_datetime.kallen_school_day_start') }} today. + Kallen does not have school today. {% endif %} - {% elif is_state('input_boolean.school_cancelled','on') %} - School is cancelled today for Kallen. - {% elif is_state('input_boolean.kallen_school_today_extended','on') and is_state('input_boolean.kallen_school_today','off') %} - {% if (ct > wakeup) and (ct < bedtime) %} - Kallen has finished his school day. - {% endif %} - {% else %} - Kallen does not have school today. {% endif %} {% endif %} {% endmacro %} diff --git a/packages/school.yaml b/packages/school.yaml index 5d99809..369e47c 100644 --- a/packages/school.yaml +++ b/packages/school.yaml @@ -329,15 +329,12 @@ automation: alias: End of School Year initial_state: true trigger: - - platform: time - at: input_datetime.school_last_day - condition: - - condition: state - entity_id: input_boolean.school_in_session - state: 'on' + - platform: template + value_template: "{{ states('sensor.school_end_days2go') | int == -1 }}" action: - - service: script.turn_on - entity_id: script.school_year_over + - service: input_boolean.turn_off + target: + entity_id: input_boolean.school_in_session - id: 068c20ee-23ba-4cd5-af31-dcfff7bdbfed alias: Kallen Two Hour Delay @@ -484,14 +481,3 @@ script: - service: input_boolean.turn_on entity_id: input_boolean.school_in_session - school_year_over: - alias: 'School Year Over' - sequence: - - condition: state - entity_id: input_boolean.school_in_session - state: 'on' - - condition: template - value_template: > - {{ states('input_datetime.school_last_day') == now().strftime("%Y-%m-%d") }} - - service: input_boolean.turn_off - entity_id: input_boolean.school_in_session \ No newline at end of file