{% if enable_status is not defined %}\r
{% set enable_status=0 %}\r
{% endif %}\r
+ {% if enable_consumption is not defined %}\r
+ {% set enable_consumption=0 %} \r
+ {% endif %} \r
{% if enable_location is not defined %}\r
{% set enable_location=0 %}\r
{% endif %}\r
{# Door Status #}\r
{%- macro status_door() -%}\r
{% for entity_id in states.group.doors.attributes.entity_id %}\r
- {% set name = entity_id.split('.')[1]|replace('_', ' ') %}\r
+ {% set name = state_attr(entity_id, 'friendly_name') %}\r
{% if is_state(entity_id, 'off') %}\r
La {{ name }} è chiusa.\r
{% else %}\r
{# Lights Status #}\r
{%- macro status_lights() -%}\r
{% for entity_id in states.group.lights.attributes.entity_id %}\r
- {% set name = entity_id.split('.')[1]|replace('_', ' ') %}\r
+ {% set name = state_attr(entity_id, 'friendly_name') %}\r
{% if is_state(entity_id, 'off') %}\r
La {{ name }} è spenta.\r
{% else %}\r
{# Covers Status #}\r
{%- macro status_covers() -%}\r
{% for entity_id in states.group.covers.attributes.entity_id %}\r
- {% set name = entity_id.split('.')[1]|replace('_', ' ') %}\r
+ {% set name = state_attr(entity_id, 'friendly_name') %}\r
{% set perc = state_attr(entity_id, 'current_position') %}\r
{% if perc | int < 25 %}\r
La {{ name }} è chiusa.\r
{%- endfor %}\r
{%- endmacro -%}\r
\r
+ {# Temperature Status #}\r
+ {%- macro status_temperature() -%}\r
+ {% for entity_id in states.group.temperature.attributes.entity_id %}\r
+ {% set name = state_attr(entity_id, 'friendly_name') %}\r
+ {% set temp = states(entity_id) %}\r
+ La {{ name }} è {{ temp }} gradi.\r
+ {%- endfor %}\r
+ {%- endmacro -%}\r
+ \r
{# Consumption Status #}\r
{%- macro status_consumption() -%}\r
"Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt"\r
{% for entity_id in states.group.people.attributes.entity_id %}\r
{% set name = state_attr(entity_id, 'friendly_name') %}\r
{% if is_state(entity_id, 'not_home') %}\r
- {% set position = state_attr(entity_id, 'address') %}\r
+ {% set source = state_attr(entity_id, 'source') %}\r
+ {% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %}\r
{% else %}\r
{% set position = states(entity_id) %}\r
{% endif %}\r
\r
{# Home Status #}\r
{% if enable_status | int == 1 %}\r
- \r
+ \r
{{ time_and_date() }}\r
\r
{{ status_door() }}\r
\r
{{ status_lights() }}\r
- \r
+ \r
{{ status_covers() }}\r
\r
- {{ status_consumption() }}\r
- \r
+ {{ status_temperature() }}\r
+ \r
{% endif %}\r
+\r
+ {% if (enable_status | int == 1) or (enable_consumption | int == 1) %}\r
+ {{ status_consumption() }}\r
+ {% endif %} \r
\r
{# Location Status #}\r
{% if (enable_status | int == 1) or (enable_location | int == 1) %}\r
{% endif %}\r
\r
{# Car Status #} \r
- {% if (enable_status | int == 1) or (enable_car | int == 1) %} \r
+ {% if (enable_status | int == 1) or (enable_car | int == 1) %}\r
{{ status_car() }}\r
{% endif %}\r
\r