blueprints/automation/wd-close-weather-notification.yaml aktualisiert

This commit is contained in:
2025-08-30 09:13:12 +00:00
parent 567881f673
commit 46e9a5c31d

View File

@@ -5,23 +5,29 @@ blueprint:
input: input:
openings: openings:
name: Windows & Doors name: Windows & Doors
description: Select windows and doors to monitor
selector: selector:
entity: entity:
domain: binary_sensor domain: binary_sensor
multiple: true multiple: true
weather_sensor: weather_sensor:
name: Weather Sensor name: Weather Sensor
description: Optional weather entity to trigger notification
default: []
selector: selector:
entity: entity:
domain: weather domain: weather
multiple: false
weather_trigger_states: weather_trigger_states:
name: Weather Trigger States (comma-separated) name: Weather Trigger States (comma-separated)
description: Notify when weather is in any of these states
default: storm,rain default: storm,rain
selector: selector:
text: text: {}
multiline: true
temperature_sensor: temperature_sensor:
name: Temperature Sensor name: Temperature Sensor
description: Optional temperature entity to trigger notification
default: []
selector: selector:
entity: entity:
domain: domain:
@@ -59,8 +65,6 @@ blueprint:
trigger: trigger:
- platform: state - platform: state
entity_id: !input weather_sensor entity_id: !input weather_sensor
# Cannot split in trigger, so we use a single state
to: !input weather_trigger_states
- platform: numeric_state - platform: numeric_state
entity_id: !input temperature_sensor entity_id: !input temperature_sensor
above: !input temp_above above: !input temp_above
@@ -78,9 +82,10 @@ action:
selected_openings: !input openings selected_openings: !input openings
message_template: !input custom_message message_template: !input custom_message
notify_service_name: !input notify_service notify_service_name: !input notify_service
# Get only entities that are currently 'on'
open_entities: > open_entities: >
{{ states {{ selected_openings
| selectattr('entity_id','in', selected_openings) | map('states')
| selectattr('state','eq','on') | selectattr('state','eq','on')
| map(attribute='attributes.friendly_name') | map(attribute='attributes.friendly_name')
| list }} | list }}
@@ -94,9 +99,11 @@ action:
- service: "{{ notify_service_name }}" - service: "{{ notify_service_name }}"
data: data:
message: > message: >
{% for entity_name in open_entities %} {% if open_entities %}
{{ message_template {{ message_template
| replace('{{ entity_name }}', entity_name) | replace('{{ entity_name }}', open_entities | join(', '))
| replace('{{ trigger_state }}', trigger_state) | replace('{{ trigger_state }}', trigger_state)
}} }}
{% endfor %} {% else %}
No windows/doors open.
{% endif %}