> {# Nightly Report #} {%- macro getReport() -%}
{% if states.sensor.halloween_countdown.state | int == 1 %}
Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I dare you to ask me to open them. '
] | random }}
{% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.halloween_countdown.state}} days
{{ [ 'until Halloween.',
'until Halloween. It might not be enough time. ',
'and counting until the best holiday ever.',
'until you need a costume.'
] | random }}
{% else %}
{% endif %}
{% if states.sensor.christmas_countdown.state | int == 1 %}
Tomorrow is Christmas.
{% if states.sensor.trip_disney.state | int == 120 %} There are only one hundred and twenty days until the next Disney Trip. {% endif %} {% if states.sensor.trip_disney.state | int == 60 %} There are only on sixty days until the next Disney Trip. {% endif %} {% if states.sensor.trip_disney.state | int < 32 %} {% if states.sensor.trip_disney.state | int > 1 %} There are {{ states.sensor.trip_disney.state }} days until the next Disney Trip! {% else %} There is {{ states.sensor.trip_disney.state }} day until the next Disney Trip! {% endif %} {% endif %} {% if states.sensor.anniversary_our_wedding.state | int == 1 %} Tomorrow is Jeff and Katherine's Wedding Anniversary. {% endif %}
{% if states.sensor.trip_disney.state | int == 1 %} Oh, and there is just one more sleep until the next Disney Trip! {% 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() -%} {{ getReport() }} {%- endmacro -%} {# Call the macro #} {{- cleanup(mother_of_all_macros()) -}}