Files
Home-Assistant-Configs/custom_templates/speech.jinja

52 lines
1.5 KiB
Django/Jinja

{% macro greeting() %}
{% 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? ",
] | random }}
{% else %}
{{ [
"Good evening. ",
"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') }}.
{% 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? ",
] | random }}
{% else %}
{{ [
"Good evening. ",
"The grandest of evenings to you. "
] | random }}
{% endif %}
It is {{ now().strftime("%I:%M %p") }}.
{% 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 ",
] | random }}<break time="1s"/> {{ states('sensor.random_joke') }}
{% endmacro %}