Updated the templates used for speech and twitter notifications

This commit is contained in:
Jeffrey Stone
2019-07-11 07:18:09 -04:00
parent f376139458
commit e8afefb9f9
14 changed files with 627 additions and 87 deletions

View File

@@ -0,0 +1,28 @@
>
{% macro getIntro() %}
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()) -}}