Improve time/date readout in TTS briefings

This commit is contained in:
2023-03-09 17:13:30 -05:00
parent 3764b153a1
commit 22f8003e28
4 changed files with 18 additions and 21 deletions

View File

@ -4,7 +4,11 @@
<p> <p>
Good morning, Collin. Good morning, Collin.
<s>It is {{ now().strftime("%I:%M %p") }}</s> {% if is_state('binary_sensor.morning','on') %}
<s>Today is {{ states.sensor.today_is.state }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}.</s>
{% else %}
<s>It is {{ now().strftime("%I:%M %p") }}.</s>
{% endif %}
{% if is_state('sensor.anniversary_kallen_s_birthday', '0') %} {% if is_state('sensor.anniversary_kallen_s_birthday', '0') %}
Even birthday boys have to get dressed. So get to it. Even birthday boys have to get dressed. So get to it.

View File

@ -2,7 +2,7 @@
{# Kallen Nightly Briefing #} {# Kallen Nightly Briefing #}
{%- macro getReport() -%} {%- macro getReport() -%}
<p> <p>
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.', {{ [ '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.', '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? <break time="2s"/>Yeah, me either. So we should keep it that way. It is time to get ready for bed.', 'Did you ever hear the one about the kid who never took a shower? <break time="2s"/>Yeah, me either. So we should keep it that way. It is time to get ready for bed.',

View File

@ -22,22 +22,14 @@
</p> </p>
<p> <p>
{% if now().strftime('%H')|int < 12 %} {% if is_state('binary_sensor.morning','on') %}
{% if now().strftime('%M')|int == 0 %} <p>
It is {{ now().strftime('%H')|int }} AM. Today is {{ states.sensor.today_is.state }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}.
{% else %} </p>
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 %} {% else %}
<p>
It is {{ now().strftime("%I:%M %p") }}.
</p>
{% endif %} {% endif %}
</p> </p>
<p> <p>

View File

@ -4,7 +4,7 @@
<p> <p>
"Welcome home, " "Welcome home, "
{% if is_state('person.tony_stork','home') and is_state('person.christina_stork','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') %} {% elif is_state('person.tony_stork','home') %}
"Tony. " "Tony. "
{% elif is_state('person.christina_stork','home') %} {% elif is_state('person.christina_stork','home') %}
@ -13,12 +13,13 @@
"Whoever you are, Tony must have broken me again. " "Whoever you are, Tony must have broken me again. "
{% endif %} {% endif %}
{% if now().strftime('%H')|int < 12 %} {% 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 %} {% 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 %} {% else %}
"and good evening. I hope you had a good day!" "and good evening. I hope you had a good day! "
{% endif %} {% endif %}
"It is currently {{ now().strftime("%I:%M %p") }}."
</p> </p>
<p> <p>