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

This commit is contained in:
2025-08-30 03:57:58 +00:00
parent 2ce7c185be
commit 0836c0d14a

View File

@@ -1,6 +1,6 @@
blueprint:
name: Open Windows/Doors Weather & Temperature Notification (Weather Trigger)
description: Notify when windows or doors are open during bad weather or extreme temperatures, triggered by weather or temperature changes.
name: Open Windows/Doors Notification (Clean)
description: Notify when windows or doors are open based on weather state or temperature thresholds.
domain: automation
input:
openings:
@@ -10,106 +10,95 @@ blueprint:
entity:
domain: binary_sensor
multiple: true
temperature_sensor:
name: Temperature Sensor
description: Select a temperature sensor or weather entity
selector:
entity:
filter:
domain:
- sensor
- weather
device_class:
- temperature
temperature_cold_threshold:
name: Cold Temperature Threshold
default: 15
selector:
number:
min: -50
max: 50
unit_of_measurement: °C
temperature_hot_threshold:
name: Hot Temperature Threshold
default: 28
selector:
number:
min: -50
max: 50
unit_of_measurement: °C
weather_entity:
name: Weather Forecast Entity
weather_sensor:
name: Weather Sensor
description: Optional weather entity to trigger notification
selector:
entity:
domain: weather
bad_weather_states:
name: Bad Weather States
weather_trigger_states:
name: Weather Trigger States
description: Select weather states that should trigger notification
default:
- storm
- rain
selector:
text:
multiline: true
temperature_sensor:
name: Temperature Sensor
description: Optional temperature entity to trigger notification
selector:
entity:
domain:
- sensor
- weather
device_class: temperature
temp_above:
name: Notify if Temperature Above
description: Optional threshold to trigger notification
default: 24
selector:
number:
min: -50
max: 50
unit_of_measurement: °C
temp_below:
name: Notify if Temperature Below
description: Optional threshold to trigger notification
default: 15
selector:
number:
min: -50
max: 50
unit_of_measurement: °C
notify_target:
name: Notification Target
selector:
target: {}
min_open_time:
name: Minimum Open Time
default: 20
selector:
number:
min: 1
max: 120
unit_of_measurement: minutes
custom_message:
name: Custom Notification Message
default: "{{ entity_name }} is open! Condition: {{ condition }}, Current temperature: {{ temperature }}°C"
default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}"
selector:
text: {}
trigger:
# Trigger for weather states
- platform: state
entity_id: !input weather_entity
- platform: state
entity_id: !input weather_sensor
to: "{{ !input weather_trigger_states.split(',') | map('trim') | list }}"
# Trigger for temperature above
- platform: numeric_state
entity_id: !input temperature_sensor
above: !input temp_above
# Trigger for temperature below
- platform: numeric_state
entity_id: !input temperature_sensor
below: !input temp_below
condition:
- condition: template
value_template: >
{% set cold_threshold = !input.temperature_cold_threshold %}
{% set hot_threshold = !input.temperature_hot_threshold %}
{% set bad_states = !input.bad_weather_states.split(',') | map('trim') %}
{% set current_temp = states(!input.temperature_sensor) | float(0) %}
{% set current_weather = states(!input.weather_entity) %}
{% set condition_met = (current_temp < cold_threshold) or (current_temp > hot_threshold) or (current_weather in bad_states) %}
{% set any_open = states | selectattr('entity_id','in',!input.openings) | selectattr('state','eq','on') | list | length > 0 %}
{{ condition_met and any_open }}
- condition: state
entity_id: !input openings
state: 'on'
action:
- variables:
cold_threshold: !input temperature_cold_threshold
hot_threshold: !input temperature_hot_threshold
current_temp: "{{ states(!input.temperature_sensor) | float(0) }}"
current_weather: "{{ states(!input.weather_entity) }}"
bad_states: "{{ !input.bad_weather_states.split(',') | map('trim') }}"
condition_text: >
{% if current_temp < cold_threshold %}too cold
{% elif current_temp > hot_threshold %}too hot
{% elif current_weather in bad_states %}bad weather
{% else %}unknown
{% endif %}
open_entities: >
{{ states | selectattr('entity_id','in',!input.openings) | selectattr('state','eq','on') | map(attribute='attributes.friendly_name') | list }}
trigger_state: >
{% if trigger.platform == 'numeric_state' %}
{{ trigger.to_state.state }}
{% else %}
{{ trigger.to_state.state }}
{% endif %}
- service: notify.notify
data:
target: "{{ !input.notify_target }}"
target: "{{ !input notify_target }}"
message: >
{% for entity_name in open_entities %}
{{ !input.custom_message
{{ !input custom_message
| replace('{{ entity_name }}', entity_name)
| replace('{{ temperature }}', current_temp | string)
| replace('{{ condition }}', condition_text)
| replace('{{ trigger_state }}', trigger_state)
}}
{% endfor %}