Add easy time macros to relevant TTS briefings

This commit is contained in:
2023-05-03 12:45:41 -04:00
parent e7415c709e
commit a7d9d6ee63
4 changed files with 50 additions and 33 deletions

View File

@ -5,6 +5,7 @@
{% from 'time.jinja' import input_datetime_12hr %}
{% from 'status.jinja' import emma_sleep %}
{% from 'formatting.jinja' import cleanup %}
{% from 'easy_time.jinja' import count_the_days, speak_the_days %}
<p>
{{ greeting() }}
</p>
@ -294,7 +295,7 @@
{% if is_state('input_boolean.kallen_school_today', 'on') %}
{% if is_state('sensor.school_start_days2go', '0') %}
Today is the first day of school! There are {{ states('sensor.school_end_days2go') }} to go until the last day.
Today is the first day of school! The last day is {{ speak_the_days('input_datetime.school_last_day') }}.
{% else %}
{{ [ 'Today is a school day.',
'Collin has school today.',
@ -319,42 +320,42 @@
{% if is_state('input_boolean.school_cancelled','on') %}
'School has been cancelled for today. '
{% endif %}
{% if states.sensor.thanksgiving_break_days2go.state | int <= 14 and states.sensor.thanksgiving_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.thanksgiving_break_start') | int <= 14) and (count_the_days('input_datetime.thanksgiving_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.thanksgiving_break_days2go.state }} days until Thanksgiving Break!
'Thanksgiving break starts {{ speak_the_days('input_datetime.thanksgiving_break_start') }}!'
{% endif %}
{% if states.sensor.christmas_break_days2go.state | int <= 14 and states.sensor.christmas_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.christmas_break_start') | int <= 14) and (count_the_days('input_datetime.christmas_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.christmas_break_days2go.state }} days until Christmas Break!
'Christmas break starts {{ speak_the_days('input_datetime.christmas_break_start') }}!'
{% endif %}
{% if states.sensor.spring_break_days2go.state | int <= 14 and states.sensor.spring_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.spring_break_start') | int <= 14) and (count_the_days('input_datetime.spring_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.spring_break_days2go.state }} days until Spring Break!
'Spring break starts {{ speak_the_days('input_datetime.spring_break_start') }}!'
{% endif %}
{% if states.sensor.school_end_days2go.state | int <= 35 and states.sensor.school_end_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.school_last_day') | int <= 35) and (count_the_days('input_datetime.school_last_day') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.school_end_days2go.state }} days left in the school year!
The school year ends {{ speak_the_days('input_datetime.school_last_day') }}.
{% endif %}
{% if now().strftime('%Y-%m-%d') == states.input_datetime.school_last_day.state %}
{% if count_the_days('input_datetime.school_last_day') | int == 0 %}
Congratulations, today is the last day of school! Have an awesome day!
{% endif %}
{% if states.sensor.school_end_days2go.state | int == -1 -%}
{% if count_the_days('input_datetime.school_last_day') | int == -1 -%}
Today is the first day of Summer Break!
{%- endif %}
{% endif %}

View File

@ -3,6 +3,7 @@
{%- macro getReport() -%}
{% from 'time.jinja' import current_time_12hr, current_date_readout, input_datetime_12hr %}
{% from 'speech.jinja' import dadjoke, inspirational_quote %}
{% from 'easy_time.jinja' import count_the_days, speak_the_days %}
<p>
Good morning, Collin.
@ -47,7 +48,7 @@
<p>
{% if is_state('input_boolean.kallen_school_today', 'on') %}
{% if is_state('sensor.school_start_days2go', '0') %}
{% if count_the_days('input_datetime.school_first_day') | int == 0 %}
Today is the first day of school!
{% else %}
{{ [ 'Today is a school day.',
@ -96,7 +97,7 @@
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>
{% if states.sensor.school_end_days2go.state | int == 0 -%}
{% if count_the_days('input_datetime.school_last_day') | int == 0 -%}
But today is the last day of School!
{%- endif %}
{{ [
@ -131,36 +132,49 @@
'Do not let your sister eat you for breakfast.',
] | random }}
{% endif %}
{% if states.sensor.thanksgiving_break_days2go.state | int <= 14 and states.sensor.thanksgiving_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.thanksgiving_break_start') | int <= 14) and (count_the_days('input_datetime.thanksgiving_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.thanksgiving_break_days2go.state }} days until Thanksgiving Break!
'Thanksgiving break starts {{ speak_the_days('input_datetime.thanksgiving_break_start') }}!'
{% endif %}
{% if states.sensor.christmas_break_days2go.state | int <= 14 and states.sensor.christmas_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.christmas_break_start') | int <= 14) and (count_the_days('input_datetime.christmas_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.christmas_break_days2go.state }} days until Christmas Break!
'Christmas break starts {{ speak_the_days('input_datetime.christmas_break_start') }}!'
{% endif %}
{% if states.sensor.spring_break_days2go.state | int <= 14 and states.sensor.spring_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.spring_break_start') | int <= 14) and (count_the_days('input_datetime.spring_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.spring_break_days2go.state }} days until Spring Break!
'Spring break starts in {{ speak_the_days('input_datetime.spring_break_start') }}!'
{% endif %}
{% if (count_the_days('input_datetime.school_last_day') | int < 35) and (count_the_days('input_datetime.school_last_day') | int > 0) -%}
{{ [ 'School is almost over for the year.',
'You have made it to the end of the school year.',
'You are almost done with school.'
] | random }}
There are only {{ count_the_days('input_datetime.school_last_day') }} days
{{ [ 'left in the school year ',
' left of school.',
'Until the last day of school.'
] | random }}
{%- endif %}
{% if is_state ('input_boolean.kallen_school_today', 'off') and is_state('sensor.pirateweather_icon', 'snow') %}
Do you wanna build a snowman? It is snowing!
{% endif %}
{% if states.sensor.school_end_days2go.state | int == -1 -%}
{% if count_the_days('input_datetime.school_last_day') | int == -1 -%}
Today is the first day of Summer Break!
{%- endif %}

View File

@ -2,6 +2,7 @@
{# Kallen Nightly Briefing #}
{%- macro getReport() -%}
{% from 'speech.jinja' import dadjoke %}
{% from 'easy_time.jinja' import count_the_days, speak_the_days %}
<p>
Good Evening, Collin, it is currently {{ now().strftime("%I:%M %p") }}.
{{ [ 'My sensors are detecting a strange smell. I am running diagnostics. But in the mean time, you should start a shower.',
@ -41,54 +42,54 @@
'so we can sleep in. '
] | random }}
{% endif %}
{% if states.sensor.school_start_days2go.state | int < 10 and states.sensor.school_start_days2go.state | int > 1 -%}
{% if (count_the_days('input_datetime.school_first_day') | int < 10) and (count_the_days('input_datetime.school_first_day') | int > 1) -%}
{{ [ 'I hate to say it, but ',
'Unfortunately,',
'All good things must come to an end.'
] | random }}
There are only {{ states.sensor.school_start_days2go.state }} days
There are only {{ count_the_days('input_datetime.school_first_day') }} days
{{ [ 'left of summer vacation. ',
' left of summer break.',
'Until School starts again.'
] | random }}
{% elif states.sensor.school_start_days2go.state | int == 0 -%}
{% elif count_the_days('input_datetime.school_first_day') | int == 1 -%}
Tomorrow is the first day of school. Are you ready?
{%- endif %}
{% if states.sensor.thanksgiving_break_days2go.state | int <= 14 and states.sensor.thanksgiving_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.thanksgiving_break_start') | int <= 14) and (count_the_days('input_datetime.thanksgiving_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.thanksgiving_break_days2go.state }} days until Thanksgiving Break!
'Thanksgiving break starts {{ speak_the_days('input_datetime.thanksgiving_break_start') }}!'
{% endif %}
{% if states.sensor.christmas_break_days2go.state | int <= 14 and states.sensor.christmas_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.christmas_break_start') | int <= 14) and (count_the_days('input_datetime.christmas_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.christmas_break_days2go.state }} days until Christmas Break!
'Christmas break starts {{ speak_the_days('input_boolean.christmas_break_start') }}!'
{% endif %}
{% if states.sensor.spring_break_days2go.state | int <= 14 and states.sensor.spring_break_days2go.state | int > 0 %}
{% if (count_the_days('input_datetime.spring_break_start') | int <= 14) and (count_the_days('input_datetime.spring_break_start') | int > 0) %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.spring_break_days2go.state }} days until Spring Break!
'Spring break starts {{ speak_the_days('input_datetime.spring_break_start') }}!'
{% endif %}
{% if states.sensor.school_end_days2go.state | int < 15 and states.sensor.school_end_days2go.state | int > 0 -%}
{% if (count_the_days('input_datetime.school_last_day') | int < 35) and (count_the_days('input_datetime.school_last_day') | int > 0) -%}
{{ [ 'School is almost over for the year.',
'You have made it to the end of the school year.',
'You are almost done with school.'
] | random }}
There are only {{ states.sensor.school_end_days2go.state }} days
There are only {{ count_the_days('input_datetime.school_last_day') }} days
{{ [ 'left in the school year ',
' left of school.',
'Until the last day of school.'
] | random }}
{% elif states.sensor.school_end_days2go.state | int == 0 -%}
{% elif count_the_days('input_datetime.school_last_day') | int == 0 -%}
Tomorrow is the first day of summer. Are you ready?
{%- endif %}
{{ [ 'I will turn on your bedroom lights and appropriate white noise device at bedtime.',

View File

@ -3,6 +3,7 @@
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting_nodate, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_12hr %}
{% from 'easy_time.jinja' import count_the_days %}
<p>
{{ greeting_nodate() }}
</p>
@ -93,7 +94,7 @@
{%- endif -%}
</p>
<p>
{% if now().strftime('%Y-%m-%d') == states.input_datetime.school_last_day.state %}
{% if count_the_days('input_datetime.school_last_day') | int == 0 %}
Congratulations, today is the last day of school! Have an awesome day!
{% endif %}
</p>