50 lines
1.7 KiB
YAML
50 lines
1.7 KiB
YAML
>
|
|
{% macro getForecast() %}
|
|
The low tonight will be {{states.sensor.dark_sky_overnight_low_temperature_0.state | round}} degrees and there is a {{states.sensor.dark_sky_precip_probability_0.state|round}} percent chance of rain.
|
|
{% endmacro %}
|
|
{% macro getTrashDay() %}
|
|
{% if is_state("sensor.weekday", "mon") %}
|
|
Tomorrow is trash day!
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{% macro getBirthdays() %}
|
|
{% if states.sensor.birthday_skylar.state | int < 2 %}
|
|
Tomorrow is Skylar's Birthday.
|
|
{% endif %}
|
|
{% if states.sensor.birthday_jeff.state | int < 2 %}
|
|
Tomorrow is Jeff's Birthday.
|
|
{% endif %}
|
|
{% if states.sensor.birthday_kat.state | int < 2 %}
|
|
Tomorrow is Katherine's Birthday.
|
|
{% endif %}
|
|
{% if states.sensor.anniversary_our_wedding.state | int < 2 %}
|
|
Tomorrow is Jeff and Katherine's Wedding Anniversary.
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{% macro getHolidays() %}
|
|
{% if states.sensor.holiday_halloween.state | int < 2 %}
|
|
Tomorrow is Halloween. Hope you have picked out a costume.
|
|
{% endif %}
|
|
{% if states.sensor.holiday_christmas.state | int < 2 %}
|
|
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() -%}
|
|
It is {{ now().strftime("%I:%M %p") }}.
|
|
{{ getForecast() }}
|
|
{{ getTrashDay() }}
|
|
{{ getBirthdays() }}
|
|
{{ getHolidays() }}
|
|
|
|
{%- endmacro -%}
|
|
|
|
{# Call the macro #}
|
|
{{- cleanup(mother_of_all_macros()) -}} |