{% set enable_status=0 %}\r
{% endif %}\r
{% if enable_consumption is not defined %}\r
- {% set enable_consumption=0 %} \r
- {% endif %} \r
+ {% set enable_consumption=0 %}\r
+ {% endif %}\r
{% if enable_location is not defined %}\r
{% set enable_location=0 %}\r
{% endif %}\r
{% endif %}\r
{% if location_people_num is not defined %}\r
{% set location_people_num=2 %}\r
- {% endif %} \r
+ {% endif %}\r
{% if enable_car is not defined %}\r
{% set enable_car=0 %}\r
{% endif %}\r
- \r
+\r
{# *********************************************** #}\r
{# ******************** Macro ******************** #}\r
{# *********************************************** #}\r
- \r
+\r
{# Greeting Message #}\r
{%- macro greeting() -%}\r
{% if now().strftime('%H')|int >= 7 and now().strftime('%H')|int < 12 %}\r
Buonanotte.\r
{% endif %}\r
{%- endmacro -%}\r
- \r
+\r
{# Time & Date #}\r
{%- macro time_and_date() -%}\r
{% set hour = now().strftime('%H') %}\r
{% set year = now().strftime('%Y') %}\r
Sono le {{ hour }} e {{ min }} del {{ day }} {{ mounth }} {{ year }}\r
{%- endmacro -%}\r
- \r
+\r
{# Door Status #}\r
{%- macro status_door() -%}\r
{% for entity_id in states.group.doors.attributes.entity_id %}\r
{% endif %}\r
{%- endfor %}\r
{%- endmacro -%}\r
- \r
+\r
{# Lights Status #}\r
{%- macro status_lights() -%}\r
{% for entity_id in states.group.lights.attributes.entity_id %}\r
{% endif %}\r
{%- endfor %}\r
{%- endmacro -%}\r
- \r
+\r
{# Covers Status #}\r
{%- macro status_covers() -%}\r
{% for entity_id in states.group.covers.attributes.entity_id %}\r
{% endif %}\r
{%- endfor %}\r
{%- endmacro -%}\r
- \r
+\r
{# Temperature Status #}\r
{%- macro status_temperature() -%}\r
{% for entity_id in states.group.temperature.attributes.entity_id %}\r
La {{ name }} è {{ temp }} gradi.\r
{%- endfor %}\r
{%- endmacro -%}\r
- \r
+\r
{# Consumption Status #}\r
{%- macro status_consumption() -%}\r
"Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt"\r
{%- endmacro -%}\r
- \r
+\r
{# Location Status #}\r
{%- macro status_location(start, num) -%}\r
{% for entity_id in states.group.people.attributes.entity_id %}\r
{% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %}\r
{% elif is_state(entity_id, 'home') %}\r
{% set position = "casa" %}\r
- {% else %} \r
+ {% else %}\r
{% set position = states(entity_id) %}\r
{% endif %}\r
- \r
+\r
{% if (loop.index >= start|int) and (loop.index < num|int+start|int) %}\r
La posizione di {{ name }} è {{ position }}.\r
- {% endif %} \r
+ {% endif %}\r
{%- endfor %}\r
{%- endmacro -%}\r
- \r
+\r
{# Car Status #}\r
{%- macro status_car() -%}\r
{% if is_state('device_tracker.ff590mr_device_tracker', 'home') %}\r
Sono inoltre presenti allarmi.\r
{% endif %}\r
{%- endmacro -%}\r
- \r
+\r
{# End Message #}\r
{%- macro end_message() -%}\r
{% if enable_status | int == 1 %}\r
] | random }}\r
{% endif %}\r
{%- endmacro -%}\r
- \r
+\r
{# *********************************************** #}\r
{# ******************* Message ******************* #}\r
{# *********************************************** #}\r
- \r
+\r
{# Greeting Message #}\r
{% if enable_greeting | int == 1 %}\r
{{ greeting() }}\r
{% endif %}\r
- \r
+\r
{# Home Status #}\r
{% if enable_status | int == 1 %}\r
- \r
+\r
{{ time_and_date() }}\r
- \r
+\r
{{ status_door() }}\r
- \r
+\r
{{ status_lights() }}\r
- \r
+\r
{{ status_covers() }}\r
- \r
+\r
{{ status_temperature() }}\r
- \r
+\r
{% endif %}\r
\r
{% if (enable_status | int == 1) or (enable_consumption | int == 1) %}\r
{{ status_consumption() }}\r
- {% endif %} \r
- \r
+ {% endif %}\r
+\r
{# Location Status #}\r
{% if (enable_status | int == 1) or (enable_location | int == 1) %}\r
{{ status_location(location_people_start, location_people_num) }}\r
{% endif %}\r
- \r
- {# Car Status #} \r
+\r
+ {# Car Status #}\r
{% if (enable_status | int == 1) or (enable_car | int == 1) %}\r
{{ status_car() }}\r
{% endif %}\r
- \r
+\r
{# generic message #}\r
{{ message }}\r
- \r
+\r
{# end message #}\r
{{ end_message() }}\r