2019-07-13 21:38:53 -04:00

35 lines
1.0 KiB
YAML
Executable File

>
{% macro getIntro() %}
{{ [
"You might not like what I have to say.",
"Are you sure you want to know?",
"I can tell you but you are probably not going to like it.",
"Here you go."
] | random }}
Under current traffic conditions
{% endmacro %}
{% macro getTrafficZoo() %}
Zoo Atlanta is {{states.sensor.home_to_zoo.state|round}} minutes away
{% endmacro %}
{% macro getTrafficCox() %}
And Cox Automotive is {{states.sensor.home_to_summit.state|round}} minutes away by car.
{% 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() -%}
{{ getTrafficZoo() }}
{{ getTrafficCox() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}