> {% macro getSnark() %} {{ [ "Good evening, ", "Before we shut this party down, ", "Good Evening Anchorage House, " ] | random }} {{ [ "I thought you might like to know. ", "I might have some bad news for you.", "Just one more thing." ] | random }} {% endmacro %} {% macro getForecast() %} The low tonight will be {{states.sensor.dark_sky_overnight_low_temperature_0d.state | round}} degrees and there is a {{states.sensor.dark_sky_precip_probability_0d.state|round}} percent chance of rain. {% endmacro %} {% macro getTrashDay() %} {% if is_state("sensor.weekday", "mon") %} Don't forget Tomorrow is trash day! {% endif %} {% endmacro %} {% macro getBirthdays() %} {% if states.sensor.birthday_skylar.state | int == 1 %} Tomorrow is Skylar's Birthday. {% endif %} {% if states.sensor.birthday_skylar.state | int > 1 %} {% if states.sensor.birthday_skylar.state | int < 5 %} Skylar's birthday is in {{states.sensor.birthday_skylar.state}} days! {% endif %} {% endif %} {% if states.sensor.birthday_jeff.state | int == 1 %} Tomorrow is Jeff's Birthday. {% endif %} {% if states.sensor.birthday_kat.state | int == 1 %} Tomorrow is Katherine's Birthday. {% endif %} {% if states.sensor.anniversary_our_wedding.state | int == 1 %} Tomorrow is Jeff and Katherine's Wedding Anniversary. {% endif %} {% endmacro %} {% macro getHolidays() %} {% if states.sensor.holiday_halloween.state | int == 1 %} Tomorrow is Halloween. Hope you have picked out a costume. {{ [ "I'll be going as a dumb home. ", "I've prepped the scary music. Just in case.", "I'll be going as HAL 9000." ] | random }} {% endif %} {% if states.sensor.holiday_christmas.state | int == 1 %} Tomorrow is Christmas. It's practically here! {% 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() -%} {{ getSnark() }} {{ getForecast() }} {{ getTrashDay() }} {{ getBirthdays() }} {{ getHolidays() }} {%- endmacro -%} {# Call the macro #} {{- cleanup(mother_of_all_macros()) -}}