432 lines
15 KiB
YAML
432 lines
15 KiB
YAML
input_boolean:
|
|
school_in_session:
|
|
name: School In Session
|
|
icon: mdi:bus-school
|
|
kallen_at_school:
|
|
name: Kallen at School
|
|
icon: mdi:school
|
|
kallen_school_today:
|
|
name: Kallen School Today
|
|
icon: mdi:bus-school
|
|
kallen_school_early_release:
|
|
name: Kallen School Early Release
|
|
icon: mdi:bus-school
|
|
kallen_school_today_extended:
|
|
name: Kallen School Today Extended
|
|
icon: mdi:bus-school
|
|
two_hour_delay:
|
|
name: Kallen Two Hour Delay
|
|
icon: mdi:bus-clock
|
|
school_cancelled:
|
|
name: Kallen School Cancelled
|
|
icon: mdi:calendar-remove
|
|
kallen_alternate_pickup:
|
|
name: Kallen Alternate Pickup
|
|
icon: mdi:car
|
|
|
|
input_datetime:
|
|
school_first_day:
|
|
name: First Day of School
|
|
has_date: true
|
|
has_time: false
|
|
icon: mdi:calendar
|
|
school_last_day:
|
|
name: Last Day of School
|
|
has_date: true
|
|
has_time: false
|
|
icon: mdi:calendar
|
|
thanksgiving_break_start:
|
|
name: Thanksgiving Break
|
|
has_date: true
|
|
has_time: false
|
|
icon: mdi:calendar-start
|
|
christmas_break_start:
|
|
name: Christmas Break
|
|
has_date: true
|
|
has_time: false
|
|
icon: mdi:calendar-start
|
|
spring_break_start:
|
|
name: Spring Break
|
|
has_date: true
|
|
has_time: false
|
|
icon: mdi:calendar-start
|
|
kallen_school_day_start:
|
|
name: School Day Start
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:clock-start
|
|
kallen_school_day_end:
|
|
name: School Day End
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:clock-end
|
|
kallen_school_day_start_reminder:
|
|
name: School Day Start Reminder
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:clock-alert
|
|
kallen_school_day_end_reminder:
|
|
name: School Day End Reminder
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:clock-alert
|
|
|
|
template:
|
|
- binary_sensor:
|
|
- name: Kallen School Tomorrow
|
|
unique_id: 73d91e2f-35b5-491c-9c8b-c6d89d67b53c
|
|
state: >-
|
|
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
|
|
{% if states.calendar.kallen_school_days.attributes.start_time == test + " 09:00:00" %}
|
|
on
|
|
{% elif states.calendar.kallen_school_days.attributes.start_time == test + " 08:00:00" %}
|
|
on
|
|
{% else %}
|
|
off
|
|
{% endif %}
|
|
icon: mdi:school
|
|
- sensor:
|
|
- name: School Start Days2go
|
|
unique_id: 94a53e67-c00f-4cc7-9309-f9033a9482f9
|
|
state: >
|
|
{% from 'easy_time.jinja' import count_the_days %}
|
|
{{ count_the_days('input_datetime.school_first_day') }}
|
|
attributes:
|
|
date: "{{ state_attr('input_datetime.school_first_day','timestamp') | timestamp_custom('%B %d, %Y') }}"
|
|
unit_of_measurement: 'Days'
|
|
- name: School End Days2go
|
|
unique_id: 589c44ec-7e16-4c72-a264-cdf54de409a9
|
|
state: >
|
|
{% from 'easy_time.jinja' import count_the_days %}
|
|
{{ count_the_days('input_datetime.school_last_day') | int }}
|
|
attributes:
|
|
date: "{{ state_attr('input_datetime.school_last_day','timestamp') | timestamp_custom('%B %d, %Y') }}"
|
|
unit_of_measurement: 'Days'
|
|
- name: Vacation Days2go
|
|
unique_id: f1628d87-e58a-4d1a-8a49-a71f0a9ed3e5
|
|
state: >
|
|
{% from 'easy_time.jinja' import count_the_days %}
|
|
{% if state_attr('calendar.vacation', 'start_time') %}
|
|
{{ count_the_days('calendar.vacation','start_time') }}
|
|
{% else %}
|
|
999
|
|
{% endif %}
|
|
unit_of_measurement: 'Days'
|
|
- name: Thanksgiving Break Days2go
|
|
unique_id: 2381e9de-407b-4304-b09a-448c169bbaf2
|
|
state: >
|
|
{% from 'easy_time.jinja' import count_the_days %}
|
|
{{ count_the_days('input_datetime.thanksgiving_break_start') }}
|
|
attributes:
|
|
date: "{{ state_attr('input_datetime.thanksgiving_break_start','timestamp') | timestamp_custom('%B %d, %Y') }}"
|
|
unit_of_measurement: 'Days'
|
|
- name: Christmas Break Days2go
|
|
unique_id: 851700f7-c593-4db8-ba4f-001cbffcfc4a
|
|
state: >
|
|
{% from 'easy_time.jinja' import count_the_days %}
|
|
{{ count_the_days('input_datetime.christmas_break_start') }}
|
|
attributes:
|
|
date: "{{ state_attr('input_datetime.christmas_break_start','timestamp') | timestamp_custom('%B %d, %Y') }}"
|
|
unit_of_measurement: 'Days'
|
|
- name: Spring Break Days2go
|
|
unique_id: cec6e687-8999-4548-991c-02ba546335f5
|
|
state: >
|
|
{% from 'easy_time.jinja' import count_the_days %}
|
|
{{ count_the_days('input_datetime.spring_break_start') }}
|
|
attributes:
|
|
date: "{{ state_attr('input_datetime.spring_break_start','timestamp') | timestamp_custom('%B %d, %Y') }}"
|
|
unit_of_measurement: 'Days'
|
|
- name: Lunch Menu Week
|
|
unique_id: 62ba9dcb-3cd3-4875-8e6f-86bebf542c37
|
|
state: >
|
|
{% if is_state('calendar.elementary_school_lunch','on') %}
|
|
{{ state_attr('calendar.elementary_school_lunch','message') }}
|
|
{% else %}
|
|
No Menu
|
|
{% endif %}
|
|
icon: >
|
|
{% if is_state_attr('calendar.elementary_school_lunch','message','First Menu') %}
|
|
mdi:numeric-1-circle
|
|
{% elif is_state_attr('calendar.elementary_school_lunch','message','Second Menu') %}
|
|
mdi:numeric-2-circle
|
|
{% elif is_state_attr('calendar.elementary_school_lunch','message','Third Menu') %}
|
|
mdi:numeric-3-circle
|
|
{% elif is_state_attr('calendar.elementary_school_lunch','message','Fourth Menu') %}
|
|
mdi:numeric-4-circle
|
|
{% else %}
|
|
mdi:calendar-end
|
|
{% endif %}
|
|
- name: Lunch Menu Items
|
|
unique_id: a2cb62d7-ae9f-4bab-81c1-81f2006391b2
|
|
icon: >
|
|
{% set week = states('sensor.kallen_lunch_menu_week') %}
|
|
{% if week == 'First Menu' %}
|
|
mdi:numeric-1-circle
|
|
{% elif week == 'Second Menu' %}
|
|
mdi:numeric-2-circle
|
|
{% elif week == 'Third Menu' %}
|
|
mdi:numeric-3-circle
|
|
{% elif week == 'Fourth Menu' %}
|
|
mdi:numeric-4-circle
|
|
{% else %}
|
|
mdi:calendar-end
|
|
{% endif %}
|
|
state: >
|
|
{% from 'formatting.jinja' import cleanup %}
|
|
{%- macro getReport() -%}
|
|
{% set week = states('sensor.kallen_lunch_menu_week') %}
|
|
{% set dow = now().strftime('%A') %}
|
|
{% if week == 'First Menu' %}
|
|
{% if dow == 'Monday' %}
|
|
Sloppy Joe, tomatoes or dip, green beans, mixed fruit, and milk.
|
|
{% elif dow == 'Tuesday' %}
|
|
Beef, taco salad, refried beans, spanish rice, peaches, and milk.
|
|
{% elif dow == 'Wednesday' %}
|
|
Optionally, Papa Johns Pizza. Otherwise, pulled pork, steamed broccoli, carrots, apples, and milk.
|
|
{% elif dow == 'Thursday' %}
|
|
Beef Stroganoff, steamed cauliflower, cucumbers, fresh fruit, and milk.
|
|
{% elif dow == 'Friday' %}
|
|
Hamburger, spinach salad, oven potatoes, applesauce, and milk.
|
|
{% endif %}
|
|
{% elif week == 'Second Menu' %}
|
|
{% if dow == 'Monday' %}
|
|
Popcorn chicken, mashed potatoes, corn, pears, bread, and milk.
|
|
{% elif dow == 'Tuesday' %}
|
|
Lasagna, garlic bread, celery, tomatoes, apple crisp, and milk.
|
|
{% elif dow == 'Wednesday' %}
|
|
Optionally, Papa Johns Pizza. Otherwise, hot ham and cheese, spinach salad, broccoli, fresh fruit, and milk.
|
|
{% elif dow == 'Thursday' %}
|
|
Turkey and noodles, mashed potatoes, carrots, peaches, bread, and milk.
|
|
{% elif down == 'Friday' %}
|
|
Hot dog with chili sauce, oven potatoes, backed beans, mixed fruit, and milk.
|
|
{% endif %}
|
|
{% elif week == 'Third Menu' %}
|
|
{% if dow == 'Monday' %}
|
|
Bosco sticks with pizza sauce, black bean salad, oven potatoes, peach crisp, and milk.
|
|
{% elif dow == 'Tuesday' %}
|
|
Toasted cheese, tomato soup, mixed vegetables, fresh fruit, treat, and milk.
|
|
{% elif dow == 'Wednesday' %}
|
|
Optionally, Papa Johns Pizza. Otherwise, popcorn chicken, mashed potatoes, carrots, apples, corn bread, and milk.
|
|
{% elif dow == 'Thursday' %}
|
|
Spaghetti, broccoli, green beans, fresh fruit, breadsticks, and milk.
|
|
{% elif dow == 'Friday' %}
|
|
Cold cut sub, spinach salad, tomatoes, pears, and milk.
|
|
{% endif %}
|
|
{% elif week == 'Fourth Menu' %}
|
|
{% if dow == 'Monday' %}
|
|
Chicken patty, baked beans, celery, mixed fruit, and milk.
|
|
{% elif dow == 'Tuesday' %}
|
|
Omelet or french toast, sausage, hash browns, tomatoes, orange, and milk.
|
|
{% elif dow == 'Wednesday' %}
|
|
Optionally, Papa Johns Pizza. Otherwise, hamburger, green beans, cauliflower, apple crisp, and milk.
|
|
{% elif dow == 'Thursday' %}
|
|
Mac and cheese, steamed broccoli, carrots, pears, bread, and milk.
|
|
{% elif dow == 'Friday' %}
|
|
Hot dog, spinach salad, oven potatoes, fresh fruit, and milk.
|
|
{% endif %}
|
|
{% else %}
|
|
No menu for the current day.
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
{{- cleanup(getReport()) -}}
|
|
|
|
|
|
# - platform: rest
|
|
# resource: https://raw.githubusercontent.com/tm24fan8/Home-Assistant-Configs/master/packages/json_data/school.json
|
|
# name: School Lunch
|
|
# scan_interval: 14400
|
|
# value_template: >
|
|
# {% set today = now().month ~ '/' ~ now().day %}
|
|
# {% set lunch = value_json.MENU.static[ today ] %}
|
|
# {%- if lunch %}
|
|
# {{ lunch }}
|
|
# {% else %}
|
|
# Nothing
|
|
# {%- endif %}
|
|
|
|
# - platform: rest
|
|
# resource: https://raw.githubusercontent.com/tm24fan8/Home-Assistant-Configs/master/packages/json_data/school.json
|
|
# name: School Event
|
|
# scan_interval: 14400
|
|
# value_template: >
|
|
# {% set today = now().month ~ '/' ~ now().day %}
|
|
# {% set event = value_json.EVENTS.static[ today ] %}
|
|
# {%- if event %}
|
|
# {{ event }}
|
|
# {% else %}
|
|
# Nothing
|
|
# {%- endif %}
|
|
|
|
automation:
|
|
- id: e1cb2d02-0423-11eb-adc1-0242ac120002
|
|
alias: Kallen School today
|
|
initial_state: true
|
|
trigger:
|
|
- platform: time
|
|
at: '03:55:00'
|
|
action:
|
|
- if:
|
|
- condition: template
|
|
value_template: >
|
|
{% from 'time.jinja' import calendar_event_today %}
|
|
{{ calendar_event_today('calendar.kallen_school_days') }}
|
|
then:
|
|
- service: script.kallen_school_today
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.school_today_ran
|
|
|
|
- id: b9028665-401c-4de3-8f13-1099160b011f
|
|
alias: Kallen School Reset
|
|
initial_state: true
|
|
trigger:
|
|
- platform: time
|
|
at: input_datetime.kallen_school_day_end
|
|
id: day_end
|
|
- platform: time
|
|
at: 00:00
|
|
id: midnight
|
|
action:
|
|
- if:
|
|
- condition: trigger
|
|
id: day_end
|
|
then:
|
|
- service: script.kallen_school_reset
|
|
- if:
|
|
- condition: trigger
|
|
id: midnight
|
|
then:
|
|
- service: script.kallen_school_reset_late
|
|
|
|
- id: 05ee0f8d-5411-4486-8acf-9bfadad2b23a
|
|
alias: End of School Year
|
|
initial_state: true
|
|
trigger:
|
|
- platform: template
|
|
value_template: "{{ states('sensor.school_end_days2go') | int == -1 }}"
|
|
action:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.school_in_session
|
|
|
|
- id: 068c20ee-23ba-4cd5-af31-dcfff7bdbfed
|
|
alias: Kallen Two Hour Delay
|
|
initial_state: true
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.two_hour_delay
|
|
from: 'off'
|
|
to: 'on'
|
|
action:
|
|
- service: script.kallen_scheduling_morning
|
|
- delay:
|
|
hours: 0
|
|
minutes: 0
|
|
seconds: 2
|
|
milliseconds: 0
|
|
- service: script.house_scheduling_morning
|
|
- delay:
|
|
hours: 0
|
|
minutes: 0
|
|
seconds: 2
|
|
milliseconds: 0
|
|
- service: script.master_bedroom_scheduling_morning
|
|
mode: single
|
|
|
|
- id: f8ecfc73-cb78-42b6-9b21-e17ef1e72741
|
|
alias: Kallen School Cancelled
|
|
initial_state: true
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.school_cancelled
|
|
from: 'off'
|
|
to: 'on'
|
|
action:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.two_hour_delay
|
|
- input_boolean.kallen_school_today
|
|
- input_boolean.kallen_school_early_release
|
|
- input_boolean.kallen_school_today_extended
|
|
- input_boolean.kallen_at_school
|
|
- input_boolean.kallen_alternate_pickup
|
|
- input_boolean.kallen_school_early_release
|
|
- delay:
|
|
hours: 0
|
|
minutes: 0
|
|
seconds: 2
|
|
milliseconds: 0
|
|
- service: script.kallen_scheduling_morning
|
|
- delay:
|
|
hours: 0
|
|
minutes: 0
|
|
seconds: 2
|
|
milliseconds: 0
|
|
- service: script.house_scheduling_morning
|
|
- delay:
|
|
hours: 0
|
|
minutes: 0
|
|
seconds: 2
|
|
milliseconds: 0
|
|
- service: script.master_bedroom_scheduling_morning
|
|
mode: single
|
|
|
|
script:
|
|
kallen_school_today:
|
|
alias: 'Kallen School Today'
|
|
sequence:
|
|
- if:
|
|
- condition: state
|
|
entity_id: calendar.kallen_early_release
|
|
state: "on"
|
|
then:
|
|
- service: input_boolean.turn_on
|
|
entity_id: input_boolean.kallen_school_early_release
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.kallen_school_day_end
|
|
data:
|
|
time: "13:45:00"
|
|
else:
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.kallen_school_day_end
|
|
data:
|
|
time: >
|
|
{% from 'time.jinja' import time_from_calendar %}
|
|
{{ time_from_calendar('calendar.kallen_school_days','end_time','set') }}
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.kallen_school_day_start
|
|
data:
|
|
time: >
|
|
{% from 'time.jinja' import time_from_calendar %}
|
|
{% if is_state('input_boolean.two_hour_delay','on') %}
|
|
{{ time_from_calendar('calendar.kallen_school_days','start_time','set','add',2) }}
|
|
{% else %}
|
|
{{ time_from_calendar('calendar.kallen_school_days','start_time','set') }}
|
|
{% endif %}
|
|
- service: input_boolean.turn_on
|
|
entity_id:
|
|
- input_boolean.kallen_school_today
|
|
- input_boolean.kallen_school_today_extended
|
|
- input_boolean.school_in_session
|
|
|
|
kallen_school_reset:
|
|
alias: 'Kallen School Reset'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
entity_id:
|
|
- input_boolean.kallen_school_today
|
|
- input_boolean.two_hour_delay
|
|
- input_boolean.school_cancelled
|
|
- input_boolean.kallen_alternate_pickup
|
|
|
|
kallen_school_reset_late:
|
|
alias: 'Kallen School Reset Late'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
entity_id:
|
|
- input_boolean.kallen_school_today_extended
|
|
- input_boolean.kallen_school_early_release |