blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -71,12 +71,11 @@ action:
|
|||||||
message_template: !input custom_message
|
message_template: !input custom_message
|
||||||
notify_service_name: !input notify_service
|
notify_service_name: !input notify_service
|
||||||
trigger_state: >
|
trigger_state: >
|
||||||
{% if trigger.platform in ['numeric_state','state'] %}
|
{% if trigger.platform in ['numeric_state','state'] and trigger.to_state is not none %}
|
||||||
{{ trigger.to_state.state }}
|
{{ trigger.to_state.state }}
|
||||||
{% else %}
|
{% else %}
|
||||||
unknown
|
unknown
|
||||||
{% endif %}
|
{% endif %}
|
||||||
# Build list of open windows dynamically
|
|
||||||
open_entities: >
|
open_entities: >
|
||||||
{% set open_list = [] %}
|
{% set open_list = [] %}
|
||||||
{% for ent_id in selected_openings %}
|
{% for ent_id in selected_openings %}
|
||||||
@@ -87,15 +86,14 @@ action:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ open_list }}
|
{{ open_list }}
|
||||||
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ open_entities | length > 0 }}"
|
|
||||||
sequence:
|
|
||||||
- service: "{{ notify_service_name }}"
|
- service: "{{ notify_service_name }}"
|
||||||
data:
|
data:
|
||||||
message: >
|
message: >
|
||||||
|
{% if open_entities | count > 0 %}
|
||||||
{{ message_template
|
{{ message_template
|
||||||
| replace('{{ entity_name }}', open_entities | join(', '))
|
| replace('{{ entity_name }}', open_entities | join(', '))
|
||||||
| replace('{{ trigger_state }}', trigger_state)
|
| replace('{{ trigger_state }}', trigger_state)
|
||||||
}}
|
}}
|
||||||
|
{% else %}
|
||||||
|
No windows/doors open.
|
||||||
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user