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 -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro garage_check() -%}
|
{%- macro garage_check() -%}
|
||||||
{% if states.group.garadget.state !='closed' -%}
|
{% if states.group.garage_doors.state !='closed' -%}
|
||||||
The
|
The
|
||||||
{%- for state in states.cover -%}
|
{%- for state in states.cover -%}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -220,71 +220,83 @@
|
||||||
{{inspirational_quote|random}}
|
{{inspirational_quote|random}}
|
||||||
{% endmacro %}
|
{% 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 ******** #}
|
{# ******** Start the Speech routines ******** #}
|
||||||
{# ********************************************* #}
|
{# ********************************************* #}
|
||||||
|
|
||||||
{% if call_no_announcement != 1 %}
|
{# a macro to call all macros :) #}
|
||||||
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
|
{%- macro mother_of_all_macros() -%}
|
||||||
Good morning.
|
|
||||||
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
|
{% if call_no_announcement != 1 %}
|
||||||
Good afternoon.
|
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
|
||||||
{% else %}
|
Good morning.
|
||||||
Good evening.
|
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
|
||||||
|
Good afternoon.
|
||||||
|
{% else %}
|
||||||
|
Good evening.
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{# Called from Annoucenments #}
|
{# Called from Annoucenments #}
|
||||||
{{ personarriving }}
|
{{ personarriving }}
|
||||||
|
|
||||||
{# Called from Nest when thermostats turn on #}
|
{# Called from Nest when thermostats turn on #}
|
||||||
{{ NestStatus }}
|
{{ NestStatus }}
|
||||||
|
|
||||||
{% if call_inside_weather == 1 %}
|
{% if call_inside_weather == 1 %}
|
||||||
{{ inside_weather() }}
|
{{ inside_weather() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if call_outside_weather == 1 and is_state('sun.sun', 'above_horizon') %}
|
{% if call_outside_weather == 1 and is_state('sun.sun', 'above_horizon') %}
|
||||||
{{ outside_weather() }}
|
{{ outside_weather() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ DoorOpened }}
|
{{ DoorOpened }}
|
||||||
{{ DoorClosed }}
|
{{ DoorClosed }}
|
||||||
|
|
||||||
{{ lock_check() }}
|
{{ lock_check() }}
|
||||||
{# These two lock statements are sent directly from automations. #}
|
{# These two lock statements are sent directly from automations. #}
|
||||||
{{ DoorLocked }}
|
{{ DoorLocked }}
|
||||||
{{ DoorUnLocked }}
|
{{ DoorUnLocked }}
|
||||||
|
|
||||||
{% if call_dark_outside == 1 %}
|
{% if call_dark_outside == 1 %}
|
||||||
{{ dark_outside() }}
|
{{ dark_outside() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if call_garage_check == 1 or is_state('sun.sun', 'below_horizon') %}
|
{% if call_garage_check == 1 or is_state('sun.sun', 'below_horizon') %}
|
||||||
{{ garage_check() }}
|
{{ garage_check() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (call_window_check == 1 or is_state('sun.sun', 'below_horizon')) or is_state('group.entry_points', 'on') %}
|
{% if (call_window_check == 1 or is_state('sun.sun', 'below_horizon')) or is_state('group.entry_points', 'on') %}
|
||||||
{{ window_check() }}
|
{{ window_check() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ NewDevice }}
|
{{ NewDevice }}
|
||||||
|
|
||||||
{% if call_light_check == 1 %}
|
{% if call_light_check == 1 %}
|
||||||
{{ light_check() }}
|
{{ light_check() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if call_responsibilities == 1 %}
|
{% if call_responsibilities == 1 %}
|
||||||
{{ responsibilities() }}
|
{{ responsibilities() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if now().strftime('%H')|int > 21 %}
|
{% if now().strftime('%H')|int > 21 %}
|
||||||
{{ medicine() }}
|
{{ medicine() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if value1 is not none %}
|
{% if value1 is not none %}
|
||||||
{{ value1 }}
|
{{ value1 }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# call a Random fact about the house or inspiration quote #}
|
{# call a Random fact about the house or inspiration quote #}
|
||||||
{{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote]|random)() }}
|
{{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote]|random)() }}
|
||||||
|
|
||||||
|
{%- endmacro -%}
|
||||||
|
{{- cleanup(mother_of_all_macros()) -}}
|
||||||
|
|
Loading…
Reference in New Issue