From 22f8003e2814873a6e42ffca7a5158be480ef9f0 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 9 Mar 2023 17:13:30 -0500 Subject: [PATCH] Improve time/date readout in TTS briefings --- templates/speech/kallen_morning_briefing.yaml | 6 ++++- templates/speech/kallen_nightly_briefing.yaml | 2 +- templates/speech/morning_briefing.yaml | 22 ++++++------------- templates/speech/welcome_home.yaml | 9 ++++---- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/templates/speech/kallen_morning_briefing.yaml b/templates/speech/kallen_morning_briefing.yaml index 3167c4b..2310bf1 100644 --- a/templates/speech/kallen_morning_briefing.yaml +++ b/templates/speech/kallen_morning_briefing.yaml @@ -4,7 +4,11 @@

Good morning, Collin. - It is {{ now().strftime("%I:%M %p") }} + {% if is_state('binary_sensor.morning','on') %} + Today is {{ states.sensor.today_is.state }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}. + {% else %} + It is {{ now().strftime("%I:%M %p") }}. + {% endif %} {% if is_state('sensor.anniversary_kallen_s_birthday', '0') %} Even birthday boys have to get dressed. So get to it. diff --git a/templates/speech/kallen_nightly_briefing.yaml b/templates/speech/kallen_nightly_briefing.yaml index 17e15dc..9267343 100644 --- a/templates/speech/kallen_nightly_briefing.yaml +++ b/templates/speech/kallen_nightly_briefing.yaml @@ -2,7 +2,7 @@ {# Kallen Nightly Briefing #} {%- macro getReport() -%}

- Good Evening, Collin, + 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.', 'It is about time that you showered, so you need to head upstairs and get on that.', 'Did you ever hear the one about the kid who never took a shower? Yeah, me either. So we should keep it that way. It is time to get ready for bed.', diff --git a/templates/speech/morning_briefing.yaml b/templates/speech/morning_briefing.yaml index 827b159..e11a669 100644 --- a/templates/speech/morning_briefing.yaml +++ b/templates/speech/morning_briefing.yaml @@ -22,22 +22,14 @@

- {% 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 %} - + {% if is_state('binary_sensor.morning','on') %} +

+ Today is {{ states.sensor.today_is.state }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}. +

{% else %} - +

+ It is {{ now().strftime("%I:%M %p") }}. +

{% endif %}

diff --git a/templates/speech/welcome_home.yaml b/templates/speech/welcome_home.yaml index fbfcb2a..2f6d3f8 100644 --- a/templates/speech/welcome_home.yaml +++ b/templates/speech/welcome_home.yaml @@ -4,7 +4,7 @@

"Welcome home, " {% if is_state('person.tony_stork','home') and is_state('person.christina_stork','home') %} - "Stork family." + "Stork family. " {% elif is_state('person.tony_stork','home') %} "Tony. " {% elif is_state('person.christina_stork','home') %} @@ -13,12 +13,13 @@ "Whoever you are, Tony must have broken me again. " {% endif %} {% if now().strftime('%H')|int < 12 %} - "I hope you're having a great morning!" + "I hope you're having a great morning! " {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %} - "I hope your afternoon has been a good one!" + "I hope your afternoon has been a good one! " {% else %} - "and good evening. I hope you had a good day!" + "and good evening. I hope you had a good day! " {% endif %} + "It is currently {{ now().strftime("%I:%M %p") }}."