Files
Home-Assistant-Configs/templates/speech/morning_briefing.yaml

191 lines
8.2 KiB
YAML

>
{# Morning Briefing #}
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting_nodate, dadjoke, inspirational_quote %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_pregame, sports_main %}
<p>
{{ greeting_nodate() }}
</p>
<p>
{{ [
'Today is ',
'If you have not been keeping track today is ',
'Do you know what day of the week it is? Today is',
'I hate to be the bearer of bad news, but today is '
]|random }}
{{states.sensor.today_is.state }}.
</p>
<p>
{{ weatherReport('full','tts','morning') }}
</p>
<p>
{% if is_state('sensor.halloween_countdown','0') %}
Happy Halloween!
{% endif %}
{% if is_state('sensor.christmas_countdown','0') %}
Merry Christmas Everyone!
{% endif %}
{% if is_state('sensor.anniversary_wedding_anniversary','0') %}
Happy Anniversary! It been an amazing {{ states.sensor.anniversary_wedding_anniversary.attributes.years }} years!
{% endif %}
{% if is_state('calendar.holidays_in_united_states', 'on') %}
Today is {{states.calendar.holidays_in_united_states.attributes.message}}.
{% endif %}
{% if states.calendar.birthdays.state == 'on' %}
Today is {{ states.calendar.birthdays.attributes.message }}! So Happy Birthday! The confetti cannon is not working otherwise I would shower you in paper garbage that someone else would have to pick up.
{% endif %}
{%- set event=states.calendar.national_holidays.attributes.message %}
{% if 'Day' in event and 'National' in event%}
{{ [
'And a very special Happy ',
'It is also ',
'Today is also known as ',
'Oh <emphasis>Look</emphasis>. Today is ',
'Want to know a fact? Today is ',
'Everyday can be a holiday. So today is '
]|random }}
{{states.calendar.national_holidays.attributes.message | replace("&"," and ") }}.
{%- endif -%}
</p>
<p>
{% 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>
<p>
{{ tinaStatusReport('work','tts') }}
</p>
<p>
{% if is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','on') %}
{% set diff = (state_attr('input_datetime.tina_workday_start','timestamp') - state_attr('input_datetime.kallen_school_day_start','timestamp')) %}
{%- if states.sensor.home_to_school.state|round > 12 %}
Traffic to the school appears heavier than normal.
{% else %}
Traffic to the school is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_school.state|round}} minutes to get to the school.
{%- if diff <= 3600 %}
{%- if states.sensor.school_to_bob_evans.state|round > 15 %}
Traffic from the school to Bob Evans appears heavier than normal.
{% else %}
Traffic from the school to Bob Evans is normal.
{% endif %}
Currently it will take {{states.sensor.school_to_bob_evans.state|round}} minutes to get to Bob Evans from the school.
{% endif %}
{% elif is_state('input_boolean.work_today','on') %}
{%- if states.sensor.home_to_bob_evans.state|round > 8 %}
Traffic to Bob Evans appears heavier than normal.
{% else %}
Traffic to Bob Evans is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_bob_evans.state|round}} minutes to get to Bob Evans.
{% elif is_state('input_boolean.kallen_school_today','on') %}
{%- if states.sensor.home_to_school.state|round > 12 %}
Traffic to the school appears heavier than normal.
{% else %}
Traffic to the school is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_school.state|round}} minutes to get to the school.
{% else %}
It appears no traffic reports are needed today. Enjoy your day off!
{% endif %}
</p>
<p>
{{ tonyStatusReport('stream','tts') }}
</p>
<p>
{% if state_attr('calendar.garbage_collection','start_time') != none %}
{% if count_the_days('calendar.garbage_collection','start_time') | int == 1 %}
{% if state_attr('calendar.garbage_collection','message') == 'Large Garbage Pickup' %}
Tomorrow is the monthly unlimited garbage pickup. Make sure to take out all regular trash, as well as any larger items that need to be disposed of.
{% else %}
Tomorrow is regular garbage pickup. Make sure that all trash cans are emptied and the outside bin has been wheeled to the curb.
{% endif %}
{% elif is_state('calendar.garbage_collection','on') %}
Today is garbage day. Please make sure to wheel the garbage bin back to the house.
{% endif %}
{% endif %}
</p>
<p>
{% if is_state('input_boolean.sports_updates','on') %}
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
{{ sports_pregame('sensor.michigan_wolverines') }}
{% endif %}
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
{{ sports_pregame('sensor.ohio_state_buckeyes') }}
{% endif %}
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
{{ sports_pregame('sensor.toledo_rockets') }}
{% endif %}
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
{{ sports_pregame('sensor.minnesota_vikings') }}
{% endif %}
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
{{ sports_pregame('sensor.san_francisco_49ers') }}
{% endif %}
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
{{ sports_pregame('sensor.cleveland_guardians') }}
{% endif %}
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
{{ sports_pregame('sensor.minnesota_twins') }}
{% endif %}
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
{{ sports_pregame('sensor.los_angeles_dodgers') }}
{% endif %}
{% endif %}
</p>
<p>
{% if is_state('input_boolean.sports_updates','on') %}
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
{{ sports_main('sensor.michigan_wolverines') }}
{% endif %}
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
{{ sports_main('sensor.ohio_state_buckeyes') }}
{% endif %}
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
{{ sports_main('sensor.toledo_rockets') }}
{% endif %}
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
{{ sports_main('sensor.minnesota_vikings') }}
{% endif %}
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
{{ sports_main('sensor.san_francisco_49ers') }}
{% endif %}
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
{{ sports_main('sensor.cleveland_guardians') }}
{% endif %}
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
{{ sports_main('sensor.minnesota_twins') }}
{% endif %}
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
{{ sports_main('sensor.los_angeles_dodgers') }}
{% endif %}
{% endif %}
</p>
<p>
{{ dadjoke() }}
</p>
<p>
{% if is_state('input_boolean.briefing_extras','on') %}
"And now we have the following extra information to pass along. {{ states('input_text.briefing_extras') }} "
{% endif %}
</p>
<p>
And finally, here is a bit of inspiration to start your day. {{ inspirational_quote() }}
</p>
{%- endmacro -%}
{{- cleanup(getReport()) -}}