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

@ -1,11 +1,11 @@
{% from 'time.jinja' import input_datetime_12hr, input_datetime_12hr_with_date, ct, next_twitch_stream, calendar_event_today, read_time_from_calendar %} {% from 'time.jinja' import input_datetime_read, ct, next_twitch_stream, calendar_event_today, read_time_from_calendar %}
{% from 'easy_time.jinja' import count_the_days, custom_time, custom_time_between, clock %} {% from 'easy_time.jinja' import count_the_days, custom_time, custom_time_between, clock %}
{% set ct = ct() | int %} {% set ct = ct() | int %}
{% macro tony_morning_meds(method) %} {% macro tony_morning_meds(method) %}
{% if is_state('binary_sensor.overnight','off') %} {% if is_state('binary_sensor.overnight','off') %}
{% if is_state('input_boolean.tony_morning_meds_taken','on') %} {% if is_state('input_boolean.tony_morning_meds_taken','on') %}
Tony took his morning meds at {{ input_datetime_12hr_with_date('input_datetime.tony_morning_meds_taken') }} today. Tony took his morning meds at {{ input_datetime_read('input_datetime.tony_morning_meds_taken','withdate') }} today.
{% elif is_state('input_boolean.tony_morning_meds_taken','off') and ct >= 21600 %} {% elif is_state('input_boolean.tony_morning_meds_taken','off') and ct >= 21600 %}
Tony has not taken his morning meds. Tony has not taken his morning meds.
{% if ct < state_attr('input_datetime.tony_morning_meds_notify','timestamp') | int %} {% if ct < state_attr('input_datetime.tony_morning_meds_notify','timestamp') | int %}
@ -14,9 +14,9 @@
'Rest assured that I will pester him mercilessly about this, starting at', 'Rest assured that I will pester him mercilessly about this, starting at',
'This is absolutely essential, and I will remind him to do it at', 'This is absolutely essential, and I will remind him to do it at',
'Since nobody including Tony himself likes him without his meds, I will remind him at', 'Since nobody including Tony himself likes him without his meds, I will remind him at',
] | random }} {{ input_datetime_12hr('input_datetime.tony_morning_meds_notify') }} today. ] | random }} {{ input_datetime_read('input_datetime.tony_morning_meds_notify') }} today.
{% else %} {% else %}
He will be reminded at {{ input_datetime_12hr('input_datetime.tony_morning_meds_notify') }} today. He will be reminded at {{ input_datetime_read('input_datetime.tony_morning_meds_notify') }} today.
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -25,7 +25,7 @@
{% macro tony_night_meds(method) %} {% macro tony_night_meds(method) %}
{% if is_state('input_boolean.tony_night_meds_taken','on') and ct < 43200 %} {% if is_state('input_boolean.tony_night_meds_taken','on') and ct < 43200 %}
Tony took his night meds at {{ input_datetime_12hr_with_date('input_datetime.tony_night_meds_taken') }} today. Tony took his night meds at {{ input_datetime_read('input_datetime.tony_night_meds_taken','withdate') }} today.
{% elif is_state('input_boolean.tony_night_meds_taken','off') and (ct >= 82800 or ct <= 21600) %} {% elif is_state('input_boolean.tony_night_meds_taken','off') and (ct >= 82800 or ct <= 21600) %}
Tony has not taken his night meds. Tony has not taken his night meds.
{% if method == 'tts' %} {% if method == 'tts' %}
@ -101,7 +101,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
"Tina has not yet been released from work, ", "Tina has not yet been released from work, ",
"Tina is still at the thankless idiot scape known as work, ", "Tina is still at the thankless idiot scape known as work, ",
"Tina is still consumed by the gods of capitalism, ", "Tina is still consumed by the gods of capitalism, ",
] | random }} she will be done at approximately {{ input_datetime_12hr('input_datetime.tina_workday_end') }}. ] | random }} she will be done at approximately {{ input_datetime_read('input_datetime.tina_workday_end') }}.
{% elif is_state('binary_sensor.evening','on') %} {% elif is_state('binary_sensor.evening','on') %}
{% if is_state('binary_sensor.tina_work_tomorrow','on') %} {% if is_state('binary_sensor.tina_work_tomorrow','on') %}
{{ [ {{ [
@ -126,7 +126,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
"Today, Tina must go and entertain the gremlins known as her customers and coworkers ", "Today, Tina must go and entertain the gremlins known as her customers and coworkers ",
"Today, Tina will be owned and operated by our lovely lord and savior capitalism starting ", "Today, Tina will be owned and operated by our lovely lord and savior capitalism starting ",
"Tina will attempt to satiate the patron saint of capitalism today " "Tina will attempt to satiate the patron saint of capitalism today "
] | random }} at {{ input_datetime_12hr('input_datetime.tina_workday_start') }}. ] | random }} at {{ input_datetime_read('input_datetime.tina_workday_start') }}.
{% else %} {% else %}
{{ [ {{ [
"Tina seems to have been granted a reprieve from her endless torture today. ", "Tina seems to have been granted a reprieve from her endless torture today. ",
@ -140,9 +140,9 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endif %} {% endif %}
{% elif method == 'text' %} {% elif method == 'text' %}
{% if tina in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %} {% 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') }} today. Tina is at work right now. She will be done at approximately {{ input_datetime_read('input_datetime.tina_workday_end') }} today.
{% elif is_state('input_boolean.work_today','on') %} {% elif is_state('input_boolean.work_today','on') %}
Tina has work at {{ input_datetime_12hr('input_datetime.tina_workday_start') }} today. Tina has work at {{ input_datetime_read('input_datetime.tina_workday_start') }} today.
{% elif is_state('input_boolean.work_today_extended','on') and is_state('input_boolean.work_today','off') %} {% elif is_state('input_boolean.work_today_extended','on') and is_state('input_boolean.work_today','off') %}
Tina has finished work for the day. Tina has finished work for the day.
{% if is_state('binary_sensor.tina_work_tomorrow','on') %} {% if is_state('binary_sensor.tina_work_tomorrow','on') %}
@ -157,7 +157,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% macro tina_morning_meds(method) %} {% macro tina_morning_meds(method) %}
{% if is_state('binary_sensor.overnight','off') %} {% if is_state('binary_sensor.overnight','off') %}
{% if is_state('input_boolean.tina_morning_meds_taken','on') %} {% if is_state('input_boolean.tina_morning_meds_taken','on') %}
Tina took her morning meds at {{ input_datetime_12hr_with_date('input_datetime.tina_morning_meds_taken') }} today. Tina took her morning meds at {{ input_datetime_read('input_datetime.tina_morning_meds_taken','withdate') }} today.
{% elif is_state('input_boolean.tina_morning_meds_taken','off') and is_state('binary_sensor.after_midnight','off') %} {% elif is_state('input_boolean.tina_morning_meds_taken','off') and is_state('binary_sensor.after_midnight','off') %}
Tina has not taken her morning meds. Tina has not taken her morning meds.
{% if ct < state_attr('input_datetime.tina_morning_meds_notify','timestamp') | int %} {% if ct < state_attr('input_datetime.tina_morning_meds_notify','timestamp') | int %}
@ -166,9 +166,9 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
'Rest assured that I will pester her mercilessly about this, starting at', 'Rest assured that I will pester her mercilessly about this, starting at',
'This is absolutely essential, and I will remind her to do it at', 'This is absolutely essential, and I will remind her to do it at',
'Her blood pressure is very important, so I will remind her at', 'Her blood pressure is very important, so I will remind her at',
] | random }} {{ input_datetime_12hr('input_datetime.tina_morning_meds_notify') }} today. ] | random }} {{ input_datetime_read('input_datetime.tina_morning_meds_notify') }} today.
{% else %} {% else %}
She will be reminded at {{ input_datetime_12hr('input_datetime.tina_morning_meds_notify') }} today. She will be reminded at {{ input_datetime_read('input_datetime.tina_morning_meds_notify') }} today.
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -199,14 +199,14 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endif %} {% endif %}
{% if wakeup <= ct <= bedtime %} {% if wakeup <= ct <= bedtime %}
{% if is_state('input_boolean.kallen_morning_meds_taken','on') %} {% if is_state('input_boolean.kallen_morning_meds_taken','on') %}
Kallen took his morning meds at {{ input_datetime_12hr_with_date('input_datetime.kallen_morning_meds_taken') }} today. Kallen took his morning meds at {{ input_datetime_read('input_datetime.kallen_morning_meds_taken','withdate') }} today.
{% else %} {% else %}
Kallen has not taken his morning meds. Kallen has not taken his morning meds.
{% if ct < state_attr('input_datetime.kallen_morning_meds_notify','timestamp') | int %} {% if ct < state_attr('input_datetime.kallen_morning_meds_notify','timestamp') | int %}
{{ ['He has a reminder scheduled for', {{ ['He has a reminder scheduled for',
'Rest assured that I will pester him mercilessly about this, starting at', 'Rest assured that I will pester him mercilessly about this, starting at',
'This is absolutely essential, and I will remind him to do it at', 'This is absolutely essential, and I will remind him to do it at',
] | random }} {{ input_datetime_12hr('input_datetime.kallen_morning_meds_notify') }} today. ] | random }} {{ input_datetime_read('input_datetime.kallen_morning_meds_notify') }} today.
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -222,7 +222,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% set diff = bedtime - ct %} {% set diff = bedtime - ct %}
{% if is_state('input_boolean.kallen_night_meds_taken','on') %} {% if is_state('input_boolean.kallen_night_meds_taken','on') %}
{% if (ct >= bedtime) or (ct < wakeup) %} {% if (ct >= bedtime) or (ct < wakeup) %}
Kallen took his night meds at {{ input_datetime_12hr_with_date('input_datetime.kallen_night_meds_taken') }} tonight. Kallen took his night meds at {{ input_datetime_read('input_datetime.kallen_night_meds_taken','withdate') }} tonight.
{% endif %} {% endif %}
{% else %} {% else %}
{% if diff <= 3600 %} {% if diff <= 3600 %}
@ -263,7 +263,7 @@ Kallen is staying elsewhere overnight.
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') %}
{{ states('input_text.kallen_pickup') }} will be picking Collin up from school today. {{ states('input_text.kallen_pickup') }} will be picking Collin up from school today.
{% else %} {% else %}
Pickup today will be at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }}. Pickup today will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}.
{% if is_state('input_boolean.kallen_school_early_release','on') %} {% if is_state('input_boolean.kallen_school_early_release','on') %}
And It is early release! And It is early release!
{% endif %} {% endif %}
@ -323,12 +323,12 @@ Kallen is staying elsewhere overnight.
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') %}
{{ states('input_text.kallen_pickup') }} will be picking him up from school today. {{ states('input_text.kallen_pickup') }} will be picking him up from school today.
{% elif is_state('input_boolean.kallen_school_early_release','on') %} {% 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. The school is on an early release schedule, pickup is at {{ input_datetime_read('input_datetime.kallen_school_day_end') }} today.
{% else %} {% else %}
His pickup time is {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }} today. His pickup time is {{ input_datetime_read('input_datetime.kallen_school_day_end') }} today.
{% endif %} {% endif %}
{% else %} {% else %}
Kallen has school at {{ input_datetime_12hr('input_datetime.kallen_school_day_start') }} today. Kallen has school at {{ input_datetime_read('input_datetime.kallen_school_day_start') }} today.
{% endif %} {% endif %}
{% elif is_state('input_boolean.school_cancelled','on') %} {% elif is_state('input_boolean.school_cancelled','on') %}
School is cancelled today for Kallen. School is cancelled today for Kallen.
@ -346,14 +346,14 @@ Kallen is staying elsewhere overnight.
{% macro kallenSleep(method) %} {% macro kallenSleep(method) %}
{% set bedtimestamp = state_attr('input_datetime.kallen_bedtime','timestamp') | int %} {% set bedtimestamp = state_attr('input_datetime.kallen_bedtime','timestamp') | int %}
{% if is_state('input_boolean.kallen_sleeping','on') %} {% if is_state('input_boolean.kallen_sleeping','on') %}
Kallen went to bed at {{ input_datetime_12hr('input_datetime.kallen_bedtime') }} tonight. Kallen went to bed at {{ input_datetime_read('input_datetime.kallen_bedtime') }} tonight.
{% if 14400 < ct < bedtimestamp %} {% if 14400 < ct < bedtimestamp %}
His scheduled wakeup time is {{ input_datetime_12hr('input_datetime.kallen_wakeup_time') }} today. His scheduled wakeup time is {{ input_datetime_read('input_datetime.kallen_wakeup_time') }} today.
{% endif %} {% endif %}
{% else %} {% else %}
Kallen woke up at {{ input_datetime_12hr('input_datetime.kallen_wakeup_time') }} today. Kallen woke up at {{ input_datetime_read('input_datetime.kallen_wakeup_time') }} today.
{% if ct > 57600 %} {% if ct > 57600 %}
His scheduled bedtime is {{ input_datetime_12hr('input_datetime.kallen_bedtime') }} tonight. His scheduled bedtime is {{ input_datetime_read('input_datetime.kallen_bedtime') }} tonight.
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
@ -379,9 +379,9 @@ Kallen is staying elsewhere overnight.
{% set asleep_day = asleep | timestamp_custom("%-d") %} {% set asleep_day = asleep | timestamp_custom("%-d") %}
{% set wakeup_day = wakeup | timestamp_custom("%-d") %} {% set wakeup_day = wakeup | timestamp_custom("%-d") %}
{% if is_state('input_boolean.emma_sleeping','off') and is_state('input_boolean.emma_has_napped','on') or ((asleep_day == day) and (wakeup_day == day)) %} {% if is_state('input_boolean.emma_sleeping','off') and is_state('input_boolean.emma_has_napped','on') or ((asleep_day == day) and (wakeup_day == day)) %}
Emma napped today for {{ custom_time_between('input_datetime.emma_down_for_nap','input_datetime.emma_up_from_nap','hour,minute') }}. She was retrieved from her room at {{ input_datetime_12hr_with_date('input_datetime.emma_up_from_nap') }} approximately. Emma napped today for {{ custom_time_between('input_datetime.emma_down_for_nap','input_datetime.emma_up_from_nap','hour,minute') }}. She was retrieved from her room at {{ input_datetime_read('input_datetime.emma_up_from_nap') }} approximately.
{% elif is_state('input_boolean.emma_has_napped','off') and ((asleep_day == day) and (wakeup_day != day)) and is_state('input_boolean.emma_sleeping','on') %} {% elif is_state('input_boolean.emma_has_napped','off') and ((asleep_day == day) and (wakeup_day != day)) and is_state('input_boolean.emma_sleeping','on') %}
Emma is down for nap. She was put down at {{ input_datetime_12hr_with_date('input_datetime.emma_down_for_nap') }} approximately. She has been asleep for {{ custom_time('input_datetime.emma_down_for_nap','hour,minute') }}. Emma is down for nap. She was put down at {{ input_datetime_read('input_datetime.emma_down_for_nap','withdate') }} approximately. She has been asleep for {{ custom_time('input_datetime.emma_down_for_nap','hour,minute') }}.
{% elif is_state('input_boolean.emma_sleeping','on') %} {% elif is_state('input_boolean.emma_sleeping','on') %}
{% if is_state('binary_sensor.early_night_mode','on') %} {% if is_state('binary_sensor.early_night_mode','on') %}
Emma is asleep for the night. Emma is asleep for the night.
@ -389,7 +389,7 @@ Kallen is staying elsewhere overnight.
Emma has not yet awoken for the day. Emma has not yet awoken for the day.
{% endif %} {% endif %}
{% else %} {% else %}
Emma is awake, and does not appear to have napped yet. She woke up at {{ input_datetime_12hr('input_datetime.emma_wakeup') }} today. Emma is awake, and does not appear to have napped yet. She woke up at {{ input_datetime_read('input_datetime.emma_wakeup') }} today.
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}

View File

@ -16,12 +16,16 @@
{{ now().strftime('%Y-%m-%d') }} {{ now().strftime('%Y-%m-%d') }}
{% endmacro %} {% endmacro %}
{% macro input_datetime_12hr(entity) %} {% macro input_datetime_read(entity,type) %}
{% if type is defined %}
{% if type == 'withdate' %}
{{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p') }}
{% elif type == 'nodate' %}
{{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p', False) }}
{% endif %}
{% else %}
{{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p', False) }} {{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p', False) }}
{% endmacro %} {% endif %}
{% macro input_datetime_12hr_with_date(entity) %}
{{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p') }}
{% endmacro %} {% endmacro %}
{% macro current_date_readout() %} {% macro current_date_readout() %}

View File

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

View File

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

View File

@ -1,7 +1,7 @@
> >
{# Kallen School Status #} {# Kallen School Status #}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'time.jinja' import input_datetime_12hr %} {% from 'time.jinja' import input_datetime_read %}
<p> <p>
"Hello Collin, " "Hello Collin, "
@ -18,11 +18,11 @@
{% endif %} {% endif %}
{% if is_state('input_boolean.kallen_school_today','on') %} {% 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') %} {% if is_state('input_boolean.kallen_school_early_release','on') %}
"There will be early dismissal today. " "There will be early dismissal today. "
{% endif %} {% 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 %} {% endif %}
</p> </p>

View File

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

View File

@ -2,7 +2,7 @@
{# Nightly Briefing #} {# Nightly Briefing #}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %} {% 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 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %} {% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %} {% from 'weather.jinja' import weatherReport %}
@ -105,18 +105,18 @@
{% elif states('climate.master_bedroom_aircon') not in ['off','unknown','unavailable'] %} {% 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. " "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') %} {% 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') %} {% 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') %} {% 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 %}
{% endif %} {% endif %}
{% if states('input_select.scheduled_climate_mode_master_bedroom_fan') != 'N/A' %} {% if states('input_select.scheduled_climate_mode_master_bedroom_fan') != 'N/A' %}
{% if is_state('fan.master_bedroom_fan','on') %} {% if is_state('fan.master_bedroom_fan','on') %}
"The master bedroom fan is already running. " "The master bedroom fan is already running. "
{% else %} {% 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 %} {% endif %}
{% endif %} {% endif %}
@ -131,9 +131,9 @@
{% elif is_state('input_boolean.white_noise_kallen_bedroom','on') %} {% elif is_state('input_boolean.white_noise_kallen_bedroom','on') %}
"Collin's white noise generator is already running. " "Collin's white noise generator is already running. "
{% elif is_state('input_select.scheduled_climate_mode_kallen_fan','Fan') %} {% 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') %} {% 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 %}
{% endif %} {% endif %}
{% else %} {% 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') %} {% 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. " "Emma's white noise generator is already running. "
{% elif is_state('input_select.scheduled_climate_mode_emma_aircon','AC') %} {% 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') %} {% 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 %}
{% endif %} {% endif %}
</p> </p>

View File

@ -2,7 +2,7 @@
{# Welcome Home #} {# Welcome Home #}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import dadjoke %} {% 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 'status.jinja' import emma_sleep %}
{% from 'easy_time.jinja' import count_the_days %} {% from 'easy_time.jinja' import count_the_days %}
<p> <p>
@ -134,12 +134,12 @@
<p> <p>
{% set tina = states.person.christina_stork.state %} {% set tina = states.person.christina_stork.state %}
{% if tina in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %} {% 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') %} {% elif is_state('input_boolean.work_today','on') %}
"Tina has work today. " "Tina has work today. "
{% endif %} {% endif %}
{% if is_state('input_boolean.kallen_at_school','on') %} {% 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') %} {% elif is_state('input_boolean.kallen_school_today','on') %}
"Kallen has school today. " "Kallen has school today. "
{% endif %} {% endif %}