Files
Home-Assistant-Configs/templates/speech/kallen_school_status.yaml
Tony Stork f5b8390ec1 School cancel and delay entities back to generalized form
No need for them to be individualized since all schools in the same district follow the same calls...
2023-03-09 18:07:14 -05:00

45 lines
1.8 KiB
YAML

>
{# Kallen School Status #}
{%- macro getReport() -%}
<p>
"Hello Collin, "
{% if is_state('input_boolean.kallen_school_today','on') %}
{% if is_state('input_boolean.two_hour_delay','on') %}
"You have school today, but there is currently a two hour delay. "
{% else %}
"You have school today, and it is running on time. "
{% endif %}
{% elif is_state('input_boolean.school_cancelled','on') %}
"School has been cancelled for today! Enjoy the unexpected day off! "
{% else %}
"You do not have school today. Enjoy your day off! "
{% endif %}
{% if is_state('input_boolean.kallen_school_today','on') %}
{% if is_state('input_boolean.kallen_band_practice','on') %}
"You have band practice this morning before school. "
{% endif %}
"Your school day will start at {{ (state_attr('input_datetime.kallen_school_day_start','timestamp') | int | timestamp_custom('%I:%M %p' , False)) }}. "
{% if is_state('input_boolean.kallen_school_early_release','on') %}
"There will be early dismissal today. "
{% endif %}
"Your school day will end at {{(state_attr('input_datetime.kallen_school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. "
{% endif %}
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}