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

This commit is contained in:
2025-08-30 10:48:45 +00:00
parent dc25f068be
commit e21d238ee6

View File

@@ -111,19 +111,19 @@ condition:
# 1. Check if an input was actually provided for the trigger that ran.
- condition: template
value_template: >-
{{ (trigger.id == 'weather_change' and iif(states(!input weather_sensor), true, false)) or
(trigger.id in ['temp_hot', 'temp_cold'] and iif(states(!input temperature_sensor), true, false)) }}
{{ (trigger.id == 'weather_change' and iif(states(input_weather_sensor), true, false)) or
(trigger.id in ['temp_hot', 'temp_cold'] and iif(states(input_temperature_sensor), true, false)) }}
# 2. Check if at least one of the selected doors/windows is 'on' (open).
- condition: template
value_template: "{{ expand(!input openings) | selectattr('state', 'eq', 'on') | list | count > 0 }}"
value_template: "{{ expand(input_openings) | selectattr('state', 'eq', 'on') | list | count > 0 }}"
# --- Actions ---
# What the automation will do when triggered and conditions are met.
action:
# Define variables to use in the message.
- variables:
open_entities: "{{ expand(!input openings) | selectattr('state', 'eq', 'on') | map(attribute='name') | list }}"
open_entities: "{{ expand(input_openings) | selectattr('state', 'eq', 'on') | map(attribute='name') | list }}"
open_count: "{{ open_entities | count }}"
# Use 'choose' to run different actions based on what triggered the automation.
- choose:
@@ -133,7 +133,7 @@ action:
id: weather_change
# Also check if the new weather state is in our list of trigger states
- condition: template
value_template: "{{ trigger.to_state.state in !input weather_trigger_states }}"
value_template: "{{ trigger.to_state.state in input_weather_trigger_states }}"
sequence:
- service: notify.notify
data:
@@ -149,7 +149,7 @@ action:
- service: notify.notify
data:
target: !input notify_target
message: "It's getting warm ({{ states(!input temperature_sensor) }}°C)! {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }}."
message: "It's getting warm ({{ states(input_temperature_sensor) }}°C)! {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }}."
title: "Open Window/Door Alert"
# Case 3: Temperature is too low
@@ -160,5 +160,5 @@ action:
- service: notify.notify
data:
target: !input notify_target
message: "It's getting cold ({{ states(!input temperature_sensor) }}°C)! {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }}."
message: "It's getting cold ({{ states(input_temperature_sensor) }}°C)! {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }}."
title: "Open Window/Door Alert"