Consolidate reading input datetimes into one macro

This commit is contained in:
2023-06-02 14:06:28 -04:00
parent 5e2bd6d80d
commit 6b29933088
8 changed files with 53 additions and 51 deletions

View File

@ -2,7 +2,6 @@
{# Daily Briefing #}
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_12hr %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %}

View File

@ -1,7 +1,7 @@
>
{# Kallen Morning Briefing #}
{%- macro getReport() -%}
{% from 'time.jinja' import current_time, current_date_readout, input_datetime_12hr %}
{% from 'time.jinja' import current_time, current_date_readout, input_datetime_read %}
{% from 'speech.jinja' import dadjoke, inspirational_quote %}
{% from 'easy_time.jinja' import count_the_days, custom_time %}
<p>
@ -81,7 +81,7 @@
"And you even get to come home a little earlier today!",
] | random }}
{% endif %}
<s>School today starts at {{ input_datetime_12hr('input_datetime.kallen_school_day_start') }}</s>
<s>School today starts at {{ input_datetime_read('input_datetime.kallen_school_day_start') }}</s>
{% if is_state('input_boolean.kallen_alternate_pickup','on') %}
Today, you will be picked up from school by {{ states('input_text.kallen_pickup') }}.
{% elif is_state('input_boolean.work_today','off') %}
@ -89,7 +89,7 @@
{% else %}
Today, you will be picked up from school by your dad.
{% endif %}
<s>Pickup today will be at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }}</s>
<s>Pickup today will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}</s>
{% if count_the_days('input_datetime.school_last_day') | int == 0 -%}
But today is the last day of School!
{%- endif %}

View File

@ -1,7 +1,7 @@
>
{# Kallen School Status #}
{%- macro getReport() -%}
{% from 'time.jinja' import input_datetime_12hr %}
{% from 'time.jinja' import input_datetime_read %}
<p>
"Hello Collin, "
@ -18,11 +18,11 @@
{% endif %}
{% if is_state('input_boolean.kallen_school_today','on') %}
"Your school day will start at {{ input_datetime_12hr('input_datetime.kallen_school_day_start') }}. "
"Your school day will start at {{ input_datetime_read('input_datetime.kallen_school_day_start') }}. "
{% if is_state('input_boolean.kallen_school_early_release','on') %}
"There will be early dismissal today. "
{% endif %}
"Your school day will end at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }}. "
"Your school day will end at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. "
{% endif %}
</p>

View File

@ -2,7 +2,6 @@
{# Morning Briefing #}
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting_nodate, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_12hr %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %}

View File

@ -2,7 +2,7 @@
{# Nightly Briefing #}
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_12hr, read_time_from_calendar, next_twitch_stream %}
{% from 'time.jinja' import input_datetime_read, read_time_from_calendar, next_twitch_stream %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %}
@ -105,18 +105,18 @@
{% elif states('climate.master_bedroom_aircon') not in ['off','unknown','unavailable'] %}
"The master bedroom air conditioner is already running in {{ states('climate.master_bedroom_aircon') }} mode. "
{% elif is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','AC') and is_state('input_boolean.hot_day','on') %}
"Today was a hot day, so the master bedroom air conditioner will activate cooling mode a bit earlier tonight at {{ input_datetime_12hr('input_datetime.master_bedroom_cooling') }}. "
"Today was a hot day, so the master bedroom air conditioner will activate cooling mode a bit earlier tonight at {{ input_datetime_read('input_datetime.master_bedroom_cooling') }}. "
{% elif is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','AC') %}
"The master bedroom air conditioner will activate cooling mode at {{ input_datetime_12hr('input_datetime.master_bedroom_cooling') }}. "
"The master bedroom air conditioner will activate cooling mode at {{ input_datetime_read('input_datetime.master_bedroom_cooling') }}. "
{% elif is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','Fan') %}
"The master bedroom air conditioner will activate fan only mode at {{ input_datetime_12hr('input_datetime.master_bedroom_cooling') }}. "
"The master bedroom air conditioner will activate fan only mode at {{ input_datetime_read('input_datetime.master_bedroom_cooling') }}. "
{% endif %}
{% endif %}
{% if states('input_select.scheduled_climate_mode_master_bedroom_fan') != 'N/A' %}
{% if is_state('fan.master_bedroom_fan','on') %}
"The master bedroom fan is already running. "
{% else %}
"The master bedroom fan will activate at {{ input_datetime_12hr('input_datetime.master_bedroom_fan') }}. "
"The master bedroom fan will activate at {{ input_datetime_read('input_datetime.master_bedroom_fan') }}. "
{% endif %}
{% endif %}
{% endif %}
@ -131,9 +131,9 @@
{% elif is_state('input_boolean.white_noise_kallen_bedroom','on') %}
"Collin's white noise generator is already running. "
{% elif is_state('input_select.scheduled_climate_mode_kallen_fan','Fan') %}
"Collin's fan will activate at {{ input_datetime_12hr('input_datetime.kallen_fan') }}. "
"Collin's fan will activate at {{ input_datetime_read('input_datetime.kallen_fan') }}. "
{% elif is_state('input_select.scheduled_climate_mode_kallen_fan','White Noise') %}
"Collin's white noise generator will activate at {{ input_datetime_12hr('input_datetime.kallen_bedtime') }}. "
"Collin's white noise generator will activate at {{ input_datetime_read('input_datetime.kallen_bedtime') }}. "
{% endif %}
{% endif %}
{% else %}
@ -149,9 +149,9 @@
{% elif is_state('input_boolean.white_noise_emma_bedroom','on') and is_state('input_select.scheduled_climate_mode_emma_aircon','White Noise') %}
"Emma's white noise generator is already running. "
{% elif is_state('input_select.scheduled_climate_mode_emma_aircon','AC') %}
"Emma's air conditioner will be activated at {{ input_datetime_12hr('input_datetime.emma_bedtime') }}. "
"Emma's air conditioner will be activated at {{ input_datetime_read('input_datetime.emma_bedtime') }}. "
{% elif is_state('input_select.scheduled_climate_mode_emma_aircon','White Noise') %}
"Emma's white noise generator will activate at {{ input_datetime_12hr('input_datetime.emma_bedtime') }}. "
"Emma's white noise generator will activate at {{ input_datetime_read('input_datetime.emma_bedtime') }}. "
{% endif %}
{% endif %}
</p>

View File

@ -2,7 +2,7 @@
{# Welcome Home #}
{%- macro getReport() -%}
{% from 'speech.jinja' import dadjoke %}
{% from 'time.jinja' import input_datetime_12hr %}
{% from 'time.jinja' import input_datetime_read %}
{% from 'status.jinja' import emma_sleep %}
{% from 'easy_time.jinja' import count_the_days %}
<p>
@ -134,12 +134,12 @@
<p>
{% set tina = states.person.christina_stork.state %}
{% if tina in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %}
"Tina is at work right now. She will be done at approximately {{ input_datetime_12hr('input_datetime.tina_workday_end') }}. "
"Tina is at work right now. She will be done at approximately {{ input_datetime_read('input_datetime.tina_workday_end') }}. "
{% elif is_state('input_boolean.work_today','on') %}
"Tina has work today. "
{% endif %}
{% if is_state('input_boolean.kallen_at_school','on') %}
"Kallen is at school right now. His pickup time will be at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }}. "
"Kallen is at school right now. His pickup time will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. "
{% elif is_state('input_boolean.kallen_school_today','on') %}
"Kallen has school today. "
{% endif %}