blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
blueprint:
|
blueprint:
|
||||||
name: Open Windows/Doors Notification
|
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
|
domain: automation
|
||||||
input:
|
input:
|
||||||
openings:
|
openings:
|
||||||
@@ -76,54 +76,42 @@ action:
|
|||||||
temp_above_threshold: !input temp_above
|
temp_above_threshold: !input temp_above
|
||||||
temp_below_threshold: !input temp_below
|
temp_below_threshold: !input temp_below
|
||||||
|
|
||||||
# Process weather states
|
|
||||||
weather_states: "{{ raw_weather_states.split(',') | map('trim') | list }}"
|
weather_states: "{{ raw_weather_states.split(',') | map('trim') | list }}"
|
||||||
|
|
||||||
# Current weather and temperature
|
# Detect currently open windows
|
||||||
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
|
|
||||||
open_entities: >
|
open_entities: >
|
||||||
{% set list = [] %}
|
{% set list = [] %}
|
||||||
{% for ent_id in openings_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' %}
|
{% if st is not none and st.state == 'on' %}
|
||||||
{% set _ = list.append(st.attributes.friendly_name | default(ent_id)) %}
|
{% set _ = list.append(st.attributes.friendly_name | default(ent_id)) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ list }}
|
{{ list }}
|
||||||
|
|
||||||
# Determine trigger info
|
# Determine trigger info safely
|
||||||
trigger_info: >
|
trigger_info: >
|
||||||
{% if trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
|
{% if trigger is defined and trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
|
||||||
Weather: {{ current_weather }}
|
Weather: {{ states[weather_sensor_id].state }}
|
||||||
{% elif trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
|
{% elif trigger is defined and trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
|
||||||
Temperature: {{ current_temperature }}°C
|
Temperature: {{ states[temperature_sensor_id].state }}°C
|
||||||
{% else %}
|
{% else %}
|
||||||
Manual trigger
|
Manual trigger
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Conditions for sending notification
|
# Weather match check
|
||||||
weather_match: >
|
weather_match: >
|
||||||
{% if trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
|
{% if trigger is defined and trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
|
||||||
{{ current_weather in weather_states }}
|
{{ states[weather_sensor_id].state in weather_states }}
|
||||||
{% else %}
|
{% else %}
|
||||||
true
|
true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
# Temperature match check
|
||||||
temperature_match: >
|
temperature_match: >
|
||||||
{% if trigger.platform == 'numeric_state' and trigger.entity_id == temperature_sensor_id %}
|
{% if trigger is defined and 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) }}
|
{% set temp = states[temperature_sensor_id].state | float %}
|
||||||
|
{{ temp >= temp_above_threshold or temp <= temp_below_threshold }}
|
||||||
{% else %}
|
{% else %}
|
||||||
true
|
true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user