mirror of
https://github.com/thejeffreystone/home-assistant-configuration.git
synced 2025-09-14 07:45:48 +00:00
Updated the templates used for speech and twitter notifications
This commit is contained in:
28
templates/traffic_report.yaml
Normal file
28
templates/traffic_report.yaml
Normal 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()) -}}
|
||||
|
||||
|
Reference in New Issue
Block a user