home-assistant-configuration/templates/skylar_night.yaml

39 lines
1.2 KiB
YAML

>
{% macro getIntro() %}
Skylar.
{{ [ "This is your friendly neighborhood smart home ",
"This is your digital life mate ",
"This is your cruise director ",
] | random }} with your end of day announcements.
Bedtime is in thirty minutes.
{% endmacro %}
{% macro getPrebedRoutine() %}
If you are taking a bath now is the time to get in the tub so you have time to brush teeth and read stories.
Otherwise it is time to put on your pajamas.
{% endmacro %}
{% macro getReminders() %}
Don't forget to feed your fish.
{% if is_state("sensor.weekday", "fri") %}
Oh, and tomorrow is the weekend, so why don't we sleep in.
{% endif %}
{% 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() -%}
It is {{ now().strftime("%I:%M %p") }}.
{{ getIntro() }}
{{ getPrebedRoutine() }}
{{ getReminders() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}