blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -111,21 +111,21 @@ condition:
|
|||||||
# 1. Check if an input was actually provided for the trigger that ran.
|
# 1. Check if an input was actually provided for the trigger that ran.
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >-
|
value_template: >-
|
||||||
{{ (trigger.id == 'weather_change' and iif(states(!input weather_sensor), true, false)) or
|
{{ (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 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).
|
# 2. Check if at least one of the selected doors/windows is 'on' (open).
|
||||||
- condition: template
|
- 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 ---
|
# --- Actions ---
|
||||||
# What the automation will do when triggered and conditions are met.
|
# What the automation will do when triggered and conditions are met.
|
||||||
action:
|
action:
|
||||||
# Define variables to use in the message.
|
# Define variables to use in the message.
|
||||||
- variables:
|
- 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 }}"
|
open_count: "{{ open_entities | count }}"
|
||||||
# Use 'choose' to run different actions based on what triggered the automation.
|
# Use 'choose' to run different actions based on what triggered the automation.
|
||||||
- choose:
|
- choose:
|
||||||
# Case 1: Weather changed
|
# Case 1: Weather changed
|
||||||
- conditions:
|
- conditions:
|
||||||
@@ -133,7 +133,7 @@ action:
|
|||||||
id: weather_change
|
id: weather_change
|
||||||
# Also check if the new weather state is in our list of trigger states
|
# Also check if the new weather state is in our list of trigger states
|
||||||
- condition: template
|
- 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:
|
sequence:
|
||||||
- service: notify.notify
|
- service: notify.notify
|
||||||
data:
|
data:
|
||||||
@@ -149,7 +149,7 @@ action:
|
|||||||
- service: notify.notify
|
- service: notify.notify
|
||||||
data:
|
data:
|
||||||
target: !input notify_target
|
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"
|
title: "Open Window/Door Alert"
|
||||||
|
|
||||||
# Case 3: Temperature is too low
|
# Case 3: Temperature is too low
|
||||||
@@ -160,5 +160,5 @@ action:
|
|||||||
- service: notify.notify
|
- service: notify.notify
|
||||||
data:
|
data:
|
||||||
target: !input notify_target
|
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"
|
title: "Open Window/Door Alert"
|
||||||
Reference in New Issue
Block a user