From b51d2f5dc265a927c28097186f3527c60a86b713 Mon Sep 17 00:00:00 2001 From: thomas Date: Sat, 30 Aug 2025 09:21:40 +0000 Subject: [PATCH] blueprints/automation/wd-close-weather-notification.yaml aktualisiert --- .../wd-close-weather-notification.yaml | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/blueprints/automation/wd-close-weather-notification.yaml b/blueprints/automation/wd-close-weather-notification.yaml index 1f7ee62..4ef410c 100644 --- a/blueprints/automation/wd-close-weather-notification.yaml +++ b/blueprints/automation/wd-close-weather-notification.yaml @@ -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: > - {{ message_template - | replace('{{ entity_name }}', open_entities | join(', ')) - | replace('{{ trigger_state }}', trigger_state) - }} + - 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 %}