Scheduling changes to account for K's morning band practices #45

This commit is contained in:
2022-09-26 15:06:55 -04:00
parent 62f4fa7dbf
commit bea0809a89
2 changed files with 46 additions and 36 deletions

View File

@ -20,6 +20,9 @@ input_boolean:
kallen_school_cancelled: kallen_school_cancelled:
name: Kallen School Cancelled name: Kallen School Cancelled
icon: mdi:calendar-remove icon: mdi:calendar-remove
kallen_band_practice:
name: Kallen Band Practice
icon: mdi:trumpet
input_datetime: input_datetime:
school_first_day: school_first_day:
@ -236,18 +239,11 @@ automation:
script: script:
kallen_school_today: kallen_school_today:
sequence: sequence:
- choose: - if:
- conditions:
- condition: template - condition: template
value_template: > value_template: >
{{ 'Early Release' in states('sensor.school_event') }} {{ 'Early Release' in states('sensor.school_event') }}
sequence: then:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.school_day_start
data:
time: >
{{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }}
- service: input_boolean.turn_on - service: input_boolean.turn_on
entity_id: input_boolean.school_early_release entity_id: input_boolean.school_early_release
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
@ -255,25 +251,35 @@ script:
entity_id: input_datetime.school_day_end entity_id: input_datetime.school_day_end
data: data:
time: "14:45:00" time: "14:45:00"
default: else:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.school_day_start
data:
time: >
{{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }}
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
target: target:
entity_id: input_datetime.school_day_end entity_id: input_datetime.school_day_end
data: data:
time: > time: >
{{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','end_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }} {{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','end_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }}
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.school_day_start
data:
time: >
{{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }}
- service: input_boolean.turn_on - service: input_boolean.turn_on
entity_id: entity_id:
- input_boolean.school_today - input_boolean.school_today
- input_boolean.school_today_extended - input_boolean.school_today_extended
- service: script.turn_on - service: script.turn_on
entity_id: script.school_in_session entity_id: script.school_in_session
- delay:
seconds: 1
- if:
- condition: template
value_template: >
{{ state_attr('input_datetime.school_day_start','timestamp') == 28800 }}
then:
- service: input_boolean.turn_on
entity_id: input_boolean.kallen_band_practice
kallen_school_reset: kallen_school_reset:
sequence: sequence:
@ -286,7 +292,9 @@ script:
kallen_school_reset_late: kallen_school_reset_late:
sequence: sequence:
- service: input_boolean.turn_off - service: input_boolean.turn_off
entity_id: input_boolean.school_today_extended entity_id:
- input_boolean.school_today_extended
- input_boolean.kallen_band_practice
tina_work_today: tina_work_today:
sequence: sequence:

View File

@ -121,6 +121,17 @@ automation:
script: script:
kallen_scheduling_morning: kallen_scheduling_morning:
sequence: sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.school_day_start
data_template:
time: >
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
11:00
{% else %}
{{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }}
{% endif %}
- delay:
seconds: 1
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
entity_id: input_datetime.kallen_wakeup_time entity_id: input_datetime.kallen_wakeup_time
data_template: data_template:
@ -129,20 +140,11 @@ script:
{% if is_state('input_boolean.kallen_two_hour_delay','on') %} {% if is_state('input_boolean.kallen_two_hour_delay','on') %}
09:30 09:30
{% else %} {% else %}
07:30 {{ (state_attr('input_datetime.school_day_start','timestamp') - 5400) | timestamp_custom('%H:%M', false) }}
{% endif %} {% endif %}
{% else %} {% else %}
10:00 10:00
{% endif %} {% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.school_day_start
data_template:
time: >
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
11:00
{% else %}
09:00
{% endif %}
- service: input_select.select_option - service: input_select.select_option
target: target:
entity_id: input_select.kallen_morning_briefing_location entity_id: input_select.kallen_morning_briefing_location
@ -165,7 +167,7 @@ script:
{% if is_state('input_boolean.kallen_two_hour_delay','on') %} {% if is_state('input_boolean.kallen_two_hour_delay','on') %}
09:40 09:40
{% else %} {% else %}
07:40 {{ (state_attr('input_datetime.school_day_start','timestamp') - 4800) | timestamp_custom('%H:%M', false) }}
{% endif %} {% endif %}
{% else %} {% else %}
10:00 10:00
@ -177,7 +179,7 @@ script:
{% if is_state('input_boolean.kallen_two_hour_delay','on') %} {% if is_state('input_boolean.kallen_two_hour_delay','on') %}
10:00 10:00
{% else %} {% else %}
08:00 {{ (state_attr('input_datetime.school_day_start','timestamp') - 3600) | timestamp_custom('%H:%M', false) }}
{% endif %} {% endif %}
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
entity_id: input_datetime.school_day_end_reminder entity_id: input_datetime.school_day_end_reminder
@ -229,7 +231,7 @@ script:
{% if is_state('input_boolean.kallen_two_hour_delay','on') %} {% if is_state('input_boolean.kallen_two_hour_delay','on') %}
10:20 10:20
{% else %} {% else %}
08:20 {{ (state_attr('input_datetime.school_day_start','timestamp') - 2400) | timestamp_custom('%H:%M', false) }}
{% endif %} {% endif %}
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','off') %} {% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','off') %}
{% if (state_attr('input_datetime.tina_workday_start','timestamp')) > 43200 %} {% if (state_attr('input_datetime.tina_workday_start','timestamp')) > 43200 %}