From 9591dd34bfa83cafab9fd9e65fc475f8af6e46ae Mon Sep 17 00:00:00 2001 From: thomas Date: Sat, 30 Aug 2025 10:17:55 +0000 Subject: [PATCH] blueprints/automation/wd-close-weather-notification.yaml aktualisiert --- .../wd-close-weather-notification.yaml | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/blueprints/automation/wd-close-weather-notification.yaml b/blueprints/automation/wd-close-weather-notification.yaml index eb04273..41328d0 100644 --- a/blueprints/automation/wd-close-weather-notification.yaml +++ b/blueprints/automation/wd-close-weather-notification.yaml @@ -1,53 +1,57 @@ blueprint: - name: Monitor Open Windows/Doors - description: Shows all selected windows/doors that are currently open. + name: Open Windows/Doors Monitor + description: Monitors selected windows/doors and lists the ones that are open. domain: automation input: - opening_devices: + opening_sensors: name: Window/Door Sensors - description: Select the devices you want to monitor + description: Select the sensors to monitor selector: entity: domain: binary_sensor multiple: true - notification_target: - name: Notification Target - description: Where should the notification be sent? - default: persistent_notification + notify_service: + name: Notification Service + description: Service to send notifications + default: persistent_notification.create selector: - action: - service: [] + action: {} trigger: - # Trigger when the state of any selected sensor changes - - platform: state - entity_id: !input opening_devices + # Template trigger that fires when any selected sensor changes + - platform: template + value_template: > + {% for sensor in opening_sensors %} + {% if is_state(sensor, 'on') %} + true + {% endif %} + {% endfor %} action: - variables: - open_devices: > + open_sensors: > {% set devices = [] %} - {% for device in opening_devices %} - {% if is_state(device, 'on') %} - {% set _ = devices.append(states[device].name) %} + {% for sensor in opening_sensors %} + {% if is_state(sensor, 'on') %} + {% set _ = devices.append(states[sensor].name) %} {% endif %} {% endfor %} {{ devices }} - choose: - - conditions: "{{ open_devices | length > 0 }}" + - conditions: "{{ open_sensors | length > 0 }}" sequence: - - service: !input notification_target + - service: !input notify_service data: + title: "Open Windows/Doors" message: > - Open windows/doors: - {% for d in open_devices %} + The following windows/doors are open: + {% for d in open_sensors %} - {{ d }} {% endfor %} - title: "Attention: Open Windows/Doors" - - conditions: "{{ open_devices | length == 0 }}" + - conditions: "{{ open_sensors | length == 0 }}" sequence: - - service: !input notification_target + - service: !input notify_service data: - message: "All selected windows/doors are closed." title: "Window/Door Status" + message: "All selected windows/doors are closed."