From f9e7b25f705430f498a4ed4148a5528eb99041c5 Mon Sep 17 00:00:00 2001 From: thomas Date: Sat, 30 Aug 2025 10:16:06 +0000 Subject: [PATCH] blueprints/automation/wd-close-weather-notification.yaml aktualisiert --- .../wd-close-weather-notification.yaml | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/blueprints/automation/wd-close-weather-notification.yaml b/blueprints/automation/wd-close-weather-notification.yaml index 3930f21..652e7c9 100644 --- a/blueprints/automation/wd-close-weather-notification.yaml +++ b/blueprints/automation/wd-close-weather-notification.yaml @@ -1,50 +1,53 @@ blueprint: - name: Open Windows/Doors Notification (Debug) - description: Debug blueprint to verify open windows/doors and notifications. + name: Monitor Open Windows/Doors + description: Shows all selected windows/doors that are currently open. domain: automation input: - openings: - name: Windows & Doors + opening_devices: + name: Window/Door Sensors + description: Select the devices you want to monitor selector: - entity: - domain: binary_sensor + device: + integration: binary_sensor multiple: true - notify_service: - name: Notification Service - default: notify.notify + notification_target: + name: Notification Target + description: Where should the notification be sent? + default: persistent_notification selector: - text: {} - custom_message: - name: Custom Message Template - default: "Open windows: {{ entity_name }}" - selector: - text: {} + action: + service: [] trigger: + # Trigger when the state of a selected sensor changes - platform: state - entity_id: !input openings + entity_id: !input opening_devices action: - variables: - openings_list: !input openings - notify_service_name: !input notify_service - message_template: !input custom_message - - open_entities: > - {% set list = [] %} - {% for ent_id in openings_list %} - {% set st = states[ent_id] if ent_id in states else None %} - {% if st is not none and st.state == 'on' %} - {% set _ = list.append(st.attributes.friendly_name | default(ent_id)) %} + open_devices: > + {% set devices = [] %} + {% for device in opening_devices %} + {% if is_state(device, 'on') %} + {% set _ = devices.append(states[device].name) %} {% endif %} {% endfor %} - {{ list }} + {{ devices }} - - service: "{{ notify_service_name }}" - data: - message: > - {% if open_entities | count > 0 %} - {{ message_template | replace('{{ entity_name }}', open_entities | join(', ')) }} - {% else %} - No windows are open. - {% endif %} + - choose: + - conditions: "{{ open_devices | length > 0 }}" + sequence: + - service: !input notification_target + data: + message: > + Open windows/doors: + {% for d in open_devices %} + - {{ d }} + {% endfor %} + title: "Attention: Open Windows/Doors" + - conditions: "{{ open_devices | length == 0 }}" + sequence: + - service: !input notification_target + data: + message: "All selected windows/doors are closed." + title: "Window/Door Status"