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:
parent
94bbce0a10
commit
6908244972
|
@ -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()) -}}
|
||||
|
|
Loading…
Reference in New Issue