From: Giorgio Ravera Date: Thu, 20 Aug 2020 13:32:37 +0000 (+0200) Subject: Minor changes to speech_message.yaml X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=a72765951405e5cbc411ed0d46a35465c8d85dc8;p=homeassistant.git Minor changes to speech_message.yaml --- diff --git a/templates/speech_message.yaml b/templates/speech_message.yaml index 00fa3f3d..46ee7b88 100644 --- a/templates/speech_message.yaml +++ b/templates/speech_message.yaml @@ -94,6 +94,22 @@ "Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt" {%- endmacro -%} + {# Location Status #} + {%- macro status_location(start, num) -%} + {% for entity_id in states.group.people.attributes.entity_id %} + {% set name = state_attr(entity_id, 'friendly_name') %} + {% if is_state(entity_id, 'not_home') %} + {% set position = state_attr(entity_id, 'address') %} + {% else %} + {% set position = states(entity_id) %} + {% endif %} + + {% if (loop.index >= start|int) and (loop.index < num|int+start|int) %} + La posizione di {{ name }} è {{ position }}. + {% endif %} + {%- endfor %} + {%- endmacro -%} + {# Car Status #} {%- macro status_car() -%} {% if is_state('device_tracker.wdd1760081v167576', state_attr('zone.home', 'friendly_name')) %} @@ -121,22 +137,6 @@ {% endif %} {%- endmacro -%} - {# Location Status #} - {%- macro status_location(start, num) -%} - {% for entity_id in states.group.people.attributes.entity_id %} - {% set name = state_attr(entity_id, 'friendly_name') %} - {% if is_state(entity_id, 'not_home') %} - {% set position = state_attr(entity_id, 'address') %} - {% else %} - {% set position = states(entity_id) %} - {% endif %} - - {% if (loop.index >= start|int) and (loop.index < num|int+start|int) %} - La posizione di {{ name }} è {{ position }}. - {% endif %} - {%- endfor %} - {%- endmacro -%} - {# End Message #} {%- macro end_message() -%} {% if enable_status | int == 1 %} @@ -174,7 +174,7 @@ {% endif %} - {# Location Info #} + {# Location Status #} {% if (enable_status | int == 1) or (enable_location | int == 1) %} {{ status_location(location_people_start, location_people_num) }} {% endif %}