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