From 46e9a5c31d2db9b5d089c1fdd5bf8d9f9bce8749 Mon Sep 17 00:00:00 2001 From: thomas Date: Sat, 30 Aug 2025 09:13:12 +0000 Subject: [PATCH] blueprints/automation/wd-close-weather-notification.yaml aktualisiert --- .../wd-close-weather-notification.yaml | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/blueprints/automation/wd-close-weather-notification.yaml b/blueprints/automation/wd-close-weather-notification.yaml index 24f1fd0..fd48650 100644 --- a/blueprints/automation/wd-close-weather-notification.yaml +++ b/blueprints/automation/wd-close-weather-notification.yaml @@ -5,23 +5,29 @@ blueprint: input: openings: name: Windows & Doors + description: Select windows and doors to monitor selector: entity: domain: binary_sensor multiple: true weather_sensor: name: Weather Sensor + description: Optional weather entity to trigger notification + default: [] selector: entity: domain: weather + multiple: false weather_trigger_states: name: Weather Trigger States (comma-separated) - default: storm, rain + description: Notify when weather is in any of these states + default: storm,rain selector: - text: - multiline: true + text: {} temperature_sensor: name: Temperature Sensor + description: Optional temperature entity to trigger notification + default: [] selector: entity: domain: @@ -59,8 +65,6 @@ blueprint: trigger: - platform: state entity_id: !input weather_sensor - # Cannot split in trigger, so we use a single state - to: !input weather_trigger_states - platform: numeric_state entity_id: !input temperature_sensor above: !input temp_above @@ -78,9 +82,10 @@ action: selected_openings: !input openings message_template: !input custom_message notify_service_name: !input notify_service + # Get only entities that are currently 'on' open_entities: > - {{ states - | selectattr('entity_id','in', selected_openings) + {{ selected_openings + | map('states') | selectattr('state','eq','on') | map(attribute='attributes.friendly_name') | list }} @@ -94,9 +99,11 @@ action: - service: "{{ notify_service_name }}" data: message: > - {% for entity_name in open_entities %} + {% if open_entities %} {{ message_template - | replace('{{ entity_name }}', entity_name) + | replace('{{ entity_name }}', open_entities | join(', ')) | replace('{{ trigger_state }}', trigger_state) }} - {% endfor %} + {% else %} + No windows/doors open. + {% endif %}