From a5edf57bd42717578cd03695771244f346cd9433 Mon Sep 17 00:00:00 2001 From: thomas Date: Sat, 30 Aug 2025 09:26:48 +0000 Subject: [PATCH] blueprints/automation/wd-close-weather-notification.yaml aktualisiert --- .../wd-close-weather-notification.yaml | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/blueprints/automation/wd-close-weather-notification.yaml b/blueprints/automation/wd-close-weather-notification.yaml index 6ec7801..da1380c 100644 --- a/blueprints/automation/wd-close-weather-notification.yaml +++ b/blueprints/automation/wd-close-weather-notification.yaml @@ -1,5 +1,5 @@ blueprint: - name: Open Windows/Doors Notification (Final Working Version) + name: Open Windows/Doors Notification (Final Working) description: Notify when windows or doors are open based on weather or temperature thresholds. Supports multiple notify services and multiple weather states. domain: automation input: @@ -46,7 +46,6 @@ blueprint: unit_of_measurement: °C notify_services: name: Notification Services - description: Comma-separated notify services (e.g., notify.mobile_app_phone,notify.alexa_media_livingroom) default: notify.notify selector: text: {} @@ -82,7 +81,6 @@ action: {{ raw_weather_states.split(',') | map('trim') | list }} notify_services_list: > {{ raw_notify_services.split(',') | map('trim') | list }} - # Build list of currently open windows/doors open_entities: > {% set open_list = [] %} {% for ent_id in selected_openings %} @@ -92,18 +90,31 @@ action: {% endif %} {% endfor %} {{ open_list }} + # Determine if weather matches selected states + weather_match: > + {% if states(trigger.entity_id) is not none %} + {{ states(trigger.entity_id).state in weather_trigger_states }} + {% else %} + false + {% endif %} - - repeat: - count: "{{ notify_services_list | count }}" - sequence: - - service: "{{ notify_services_list[repeat.index0] }}" - 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 %} + - choose: + - conditions: + - condition: template + value_template: "{{ open_entities | count > 0 }}" + sequence: + - choose: + - conditions: + - condition: template + value_template: "{{ trigger.entity_id != None and (trigger.entity_id == temperature_sensor or weather_match) }}" + sequence: + - repeat: + count: "{{ notify_services_list | count }}" + sequence: + - service: "{{ notify_services_list[repeat.index0] }}" + data: + message: > + {{ message_template + | replace('{{ entity_name }}', open_entities | join(', ')) + | replace('{{ trigger_state }}', trigger_state) + }}