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

This commit is contained in:
2025-08-30 09:36:59 +00:00
parent e54870039d
commit af32d655fb

View File

@@ -1,6 +1,6 @@
blueprint:
name: Open Windows/Doors Notification
description: Notify when windows or doors are open. Triggers on weather or temperature thresholds or manual execution.
description: Notify when windows or doors are open, triggered by weather, temperature, or manual execution.
domain: automation
input:
openings:
@@ -76,54 +76,42 @@ action:
temp_above_threshold: !input temp_above
temp_below_threshold: !input temp_below
# Process weather states
weather_states: "{{ raw_weather_states.split(',') | map('trim') | list }}"
# Current weather and temperature
current_weather: >
{% if states(weather_sensor_id) is not none %}
{{ states(weather_sensor_id).state }}
{% else %}
unknown
{% endif %}
current_temperature: >
{% if states(temperature_sensor_id) is not none %}
{{ states(temperature_sensor_id).state }}
{% else %}
unknown
{% endif %}
# Open windows/doors
# Detect currently open windows
open_entities: >
{% set list = [] %}
{% for ent_id in openings_list %}
{% set st = states(ent_id) %}
{% set st = states[ent_id] if ent_id in states else None %}
{% if st is not none and st.state == 'on' %}
{% set _ = list.append(st.attributes.friendly_name | default(ent_id)) %}
{% endif %}
{% endfor %}
{{ list }}
# Determine trigger info
# Determine trigger info safely
trigger_info: >
{% if trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
Weather: {{ current_weather }}
{% elif trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
Temperature: {{ current_temperature }}°C
{% if trigger is defined and trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
Weather: {{ states[weather_sensor_id].state }}
{% elif trigger is defined and trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
Temperature: {{ states[temperature_sensor_id].state }}°C
{% else %}
Manual trigger
{% endif %}
# Conditions for sending notification
# Weather match check
weather_match: >
{% if trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
{{ current_weather in weather_states }}
{% if trigger is defined and trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
{{ states[weather_sensor_id].state in weather_states }}
{% else %}
true
{% endif %}
# Temperature match check
temperature_match: >
{% if trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
{{ (trigger.to_state.state | float >= temp_above_threshold) or (trigger.to_state.state | float <= temp_below_threshold) }}
{% if trigger is defined and trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
{% set temp = states[temperature_sensor_id].state | float %}
{{ temp >= temp_above_threshold or temp <= temp_below_threshold }}
{% else %}
true
{% endif %}