mirror of
https://github.com/thejeffreystone/home-assistant-configuration.git
synced 2025-09-02 02:52:12 +00:00
Major audible notification overhual. It was hard to maintain. This will be easier. Maybe
This commit is contained in:
164
config/templates/speech/morning_briefing.yaml
Executable file
164
config/templates/speech/morning_briefing.yaml
Executable file
@@ -0,0 +1,164 @@
|
||||
>
|
||||
{# Morning Report #}
|
||||
{%- macro getReport() -%}
|
||||
<p>
|
||||
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
|
||||
Good morning.
|
||||
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
|
||||
Good afternoon.
|
||||
{% else %}
|
||||
Good evening.
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
{% if now().strftime('%H')|int < 12 %}
|
||||
{% if now().strftime('%M')|int == 0 %}
|
||||
It is {{ now().strftime('%H')|int }} AM.
|
||||
{% else %}
|
||||
It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} AM.
|
||||
{% endif %}
|
||||
|
||||
{% elif now().strftime('%H')|int > 12 %}
|
||||
{% if now().strftime('%M')|int == 0 %}
|
||||
It is {{ now().strftime('%H')|int }} PM.
|
||||
{% else %}
|
||||
It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} PM.
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</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>
|
||||
It is currently {{states.weather.home_2.state}} and {{states.sensor.back_porch.state|round}} degrees in Grayson.
|
||||
</p>
|
||||
<p>
|
||||
{% if states.sensor.nws_alerts.state | int > 0 %}
|
||||
There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area.
|
||||
The National Weather Service Has issued,
|
||||
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
|
||||
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}.
|
||||
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
|
||||
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}.
|
||||
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
|
||||
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}.
|
||||
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
|
||||
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}.
|
||||
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
|
||||
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}.
|
||||
{% else %}
|
||||
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
{{ [
|
||||
'The rest of the day should be,',
|
||||
'Todays forecast should be ,'
|
||||
]|random }}
|
||||
{{ states.sensor.nws_current_forecast.state }}
|
||||
</p>
|
||||
<p>
|
||||
{% if is_state('input_boolean.heartworm', 'on') %}
|
||||
Today is the day Winston gets his heartworm medicine.
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
{% if is_state('sensor.today_is', 'Monday') %}
|
||||
{% if now().strftime('%H')|int > 17 %}
|
||||
{{ [ 'Do not forget tomorrow is Trash Day. ',
|
||||
'I advise you move the trash cans to the curb for the weekly pickup. ',
|
||||
' The trash and recycle should go out.'
|
||||
] | random }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</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_our_wedding','0') %}
|
||||
Happy Anniversary! It been an amazing {{ states.sensor.anniversary_our_wedding.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 is_state('calendar.anchorage_holidays', 'on') %}
|
||||
And do not forget. Today is also {{states.calendar.anchorage_holidays.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.
|
||||
{% 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 ") }}.
|
||||
{{ [
|
||||
'We should celebrate.',
|
||||
'I will leave the party planning up to <emphasis>you</emphasis>.',
|
||||
'I bet <emphasis>you</emphasis> are glad I told you.',
|
||||
'Wait. <emphasis>Really.</emphasis> That cannot be a <emphasis>Real</emphasis> holiday.',
|
||||
'Wait. <emphasis>That</emphasis> is a <emphasis>Real</emphasis> holiday?',
|
||||
'Umm. Okay. You <emphasis>cannot</emphasis> make this stuff up.',
|
||||
'But, <emphasis>that</emphasis> just sounds silly.',
|
||||
'You did not know did <emphasis>you</emphasis>? But, <emphasis>now </emphasis> you do.'
|
||||
]|random }}
|
||||
{{ [
|
||||
'Anyway. ',
|
||||
'Moving On. ',
|
||||
'Back to the morning announcements. ',
|
||||
'Right. Well. '
|
||||
]|random }}
|
||||
{%- endif -%}
|
||||
</p>
|
||||
<p>
|
||||
|
||||
{%- if states.sensor.home_to_zoo.state|round > 50 %}
|
||||
Traffic to the Zoo appears heavy than normnal.
|
||||
{% else %}
|
||||
Traffic to the Zoo is normal.
|
||||
{% endif %}
|
||||
Currently it will take {{states.sensor.home_to_zoo.state|round}} minutes to get to the Zoo.
|
||||
|
||||
{%- if states.sensor.home_to_summit.state|round > 50 %}
|
||||
Traffic to the Cox Automotive appears heavy than normnal.
|
||||
{% else %}
|
||||
Traffic to the Cox is normal.
|
||||
{% endif %}
|
||||
Currently it will take {{states.sensor.home_to_summit.state|round}} minutes to get to Cox Automotive.
|
||||
</p>
|
||||
{%- endmacro -%}
|
||||
|
||||
|
||||
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
||||
{%- macro cleanup(data) -%}
|
||||
{%- for item in data.split("\n") if item | trim != "" -%}
|
||||
{{ item | trim }} {% endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{# a macro to call all macros :) #}
|
||||
{%- macro mother_of_all_macros() -%}
|
||||
{{ getReport() }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{# Call the macro #}
|
||||
{{- cleanup(mother_of_all_macros()) -}}
|
Reference in New Issue
Block a user