Finally got around to adding the Mother of all Macros from @thejeffreystone - https://github.com/thejeffreystone/home-assistant-configuration/pull/73 - Updated to handle underscores now.

This commit is contained in:
ccostan 2020-06-08 15:27:38 -04:00
parent 94bbce0a10
commit 6908244972
1 changed files with 61 additions and 49 deletions

View File

@ -92,7 +92,7 @@
{%- endmacro -%}
{%- macro garage_check() -%}
{% if states.group.garadget.state !='closed' -%}
{% if states.group.garage_doors.state !='closed' -%}
The
{%- for state in states.cover -%}
{%- endfor %}
@ -220,10 +220,19 @@
{{inspirational_quote|random}}
{% endmacro %}
{# a macro that removes all newline characters, empty spaces, and returns formatted text and replaces underscores with spaces #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim | replace("_", " ") }} {% endfor -%}
{%- endmacro -%}
{# ********************************************* #}
{# ******** Start the Speech routines ******** #}
{# ********************************************* #}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{% if call_no_announcement != 1 %}
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
Good morning.
@ -288,3 +297,6 @@
{# call a Random fact about the house or inspiration quote #}
{{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote]|random)() }}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}