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

@ -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.',