From 2dd52b58e65a5816170dbfca21e7d40889b2a473 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 9 Oct 2023 18:32:22 -0400 Subject: [PATCH] More briefing tweaks #97 --- custom_templates/speech.jinja | 42 ++++++++++---------------- templates/speech/daily_briefing.yaml | 8 +++-- templates/speech/morning_briefing.yaml | 12 ++------ templates/speech/nightly_briefing.yaml | 2 +- 4 files changed, 26 insertions(+), 38 deletions(-) diff --git a/custom_templates/speech.jinja b/custom_templates/speech.jinja index 716243e..f7c714f 100644 --- a/custom_templates/speech.jinja +++ b/custom_templates/speech.jinja @@ -1,4 +1,4 @@ -{% macro greeting() %} +{% macro greeting(date) %} {% if now().strftime('%H')|int < 12 %} {{ [ "Good morning. ", @@ -18,43 +18,33 @@ "The grandest of evenings to you. " ] | random }} {% endif %} -{% if is_state('binary_sensor.morning','on') %} - Today is {{ states('sensor.today_is') }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}. +{% if is_state('binary_sensor.morning','on') and date == 'date' %} + Today's date is {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}. {% endif %} It is {{ now().strftime("%I:%M %p") }}. {% endmacro %} -{% macro greeting_nodate() %} -{% if now().strftime('%H')|int < 12 %} - {{ [ - "Good morning. ", - "Top of the morning to you laddy. ", - ] | random }} -{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %} - {{ [ - "Greetings earthling. ", - "Good afternoon. ", - "How do you do, fellow kids? ", - "Howdy partner. ", - "Greetings, human overlords. ", - ] | random }} -{% else %} - {{ [ - "Good evening. ", - "The grandest of evenings to you. " - ] | random }} -{% endif %} -It is {{ now().strftime("%I:%M %p") }}. +{% macro today_is() %} +{{ [ + '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 ', + 'In case you do not own a calendar, today is ', + 'If you have forgotten the order in which the week progresses, today is ', + 'Because we all forget sometimes, today is ', + 'What day is today? Oh, right, it is ' +]|random }} +{{ states('sensor.today_is') }}. {% endmacro %} {% macro dadjoke() %} {{ [ "Here is a random dad joke ", "In case you hadn't had enough idiotic humor today, here is a little more ", -"For further proof that the developer responsible for my existence is an idiot, I present the following joke ", -"I like jokes. I particularly like stupid jokes. Here is an example ", "The best jokes are the dumb ones like this one ", "And now for todays episode of humor for morons ", +"We are all dead inside, so here is another idiotic joke ", ] | random }} {{ states('sensor.random_joke') }} {% endmacro %} diff --git a/templates/speech/daily_briefing.yaml b/templates/speech/daily_briefing.yaml index 09eb32f..b3f4c44 100644 --- a/templates/speech/daily_briefing.yaml +++ b/templates/speech/daily_briefing.yaml @@ -2,13 +2,17 @@ {# Daily Briefing #} {% from 'formatting.jinja' import cleanup %} {%- macro getReport() -%} - {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %} + {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote, today_is %} {% from 'status.jinja' import houseStatusReport, tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %} {% from 'easy_time.jinja' import count_the_days %} {% from 'weather.jinja' import weatherReport %} {% from 'sports.jinja' import sports_updates %}

- {{ greeting() }} + {{ greeting('date') }} +

+ +

+ {{ today_is() }}

diff --git a/templates/speech/morning_briefing.yaml b/templates/speech/morning_briefing.yaml index 71f1009..90bbb5b 100644 --- a/templates/speech/morning_briefing.yaml +++ b/templates/speech/morning_briefing.yaml @@ -2,22 +2,16 @@ {# Morning Briefing #} {% from 'formatting.jinja' import cleanup %} {%- macro getReport() -%} - {% from 'speech.jinja' import greeting_nodate, dadjoke, inspirational_quote %} + {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote, today_is %} {% 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_updates %}

- {{ greeting_nodate() }} + {{ greeting('nodate') }}

- {{ [ - '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 }}. + {{ today_is() }}

diff --git a/templates/speech/nightly_briefing.yaml b/templates/speech/nightly_briefing.yaml index 8fdc85f..94311de 100644 --- a/templates/speech/nightly_briefing.yaml +++ b/templates/speech/nightly_briefing.yaml @@ -9,7 +9,7 @@ {% from 'weather.jinja' import weatherReport %} {% from 'sports.jinja' import sports_updates %}

- {{ greeting() }} + {{ greeting('date') }}

{{ [