2025-08-30 03:22:01 +00:00
blueprint :
2025-08-30 09:33:14 +00:00
name : Open Windows/Doors Notification (Clean Final)
description : Notify when windows or doors are open. Triggers on weather, temperature, or manual execution. Only sends notifications if windows/doors are open.
2025-08-30 03:22:01 +00:00
domain : automation
input :
openings :
name : Windows & Doors
selector :
entity :
2025-08-30 03:52:22 +00:00
domain : binary_sensor
2025-08-30 03:22:01 +00:00
multiple : true
2025-08-30 03:57:58 +00:00
weather_sensor :
name : Weather Sensor
selector :
entity :
domain : weather
2025-08-30 09:13:12 +00:00
multiple : false
2025-08-30 09:05:04 +00:00
weather_trigger_states :
name : Weather Trigger States (comma-separated)
2025-08-30 09:13:12 +00:00
default : storm,rain
2025-08-30 03:57:58 +00:00
selector :
2025-08-30 09:13:12 +00:00
text : {}
2025-08-30 03:44:06 +00:00
temperature_sensor :
name : Temperature Sensor
2025-08-30 03:22:01 +00:00
selector :
entity :
2025-08-30 09:05:04 +00:00
domain :
- sensor
- weather
2025-08-30 03:57:58 +00:00
device_class : temperature
temp_above :
name : Notify if Temperature Above
2025-08-30 04:00:42 +00:00
default : 22
2025-08-30 03:49:51 +00:00
selector :
number :
min : -50
max : 50
unit_of_measurement : °C
2025-08-30 03:57:58 +00:00
temp_below :
name : Notify if Temperature Below
2025-08-30 04:00:42 +00:00
default : 17
2025-08-30 03:49:51 +00:00
selector :
number :
min : -50
max : 50
unit_of_measurement : °C
2025-08-30 09:33:14 +00:00
notify_service :
name : Notification Service
2025-08-30 09:00:50 +00:00
default : notify.notify
2025-08-30 03:22:01 +00:00
selector :
2025-08-30 09:00:01 +00:00
text : {}
2025-08-30 03:22:01 +00:00
custom_message :
2025-08-30 09:05:04 +00:00
name : Custom Message Template
2025-08-30 09:33:14 +00:00
default : "{{ entity_name }} is open! Trigger: {{ trigger_info }}"
2025-08-30 03:22:01 +00:00
selector :
text : {}
2025-08-30 09:09:00 +00:00
2025-08-30 03:22:01 +00:00
trigger :
- platform : state
2025-08-30 03:57:58 +00:00
entity_id : !input weather_sensor
- platform : numeric_state
2025-08-30 03:53:42 +00:00
entity_id : !input temperature_sensor
2025-08-30 03:57:58 +00:00
above : !input temp_above
- platform : numeric_state
entity_id : !input temperature_sensor
below : !input temp_below
2025-08-30 09:09:00 +00:00
2025-08-30 03:22:01 +00:00
action :
- variables :
2025-08-30 09:28:10 +00:00
# Inputs
openings_list : !input openings
2025-08-30 09:33:14 +00:00
weather_sensor_id : !input weather_sensor
temperature_sensor_id : !input temperature_sensor
2025-08-30 09:25:08 +00:00
raw_weather_states : !input weather_trigger_states
2025-08-30 09:33:14 +00:00
notify_service_name : !input notify_service
message_template : !input custom_message
temp_above_threshold : !input temp_above
temp_below_threshold : !input temp_below
2025-08-30 09:28:10 +00:00
2025-08-30 09:33:14 +00:00
# Process weather states
2025-08-30 09:28:10 +00:00
weather_states : "{{ raw_weather_states.split(',') | map('trim') | list }}"
2025-08-30 09:33:14 +00:00
# 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 }}
2025-08-30 09:20:18 +00:00
{% else %}
unknown
{% endif %}
2025-08-30 09:28:10 +00:00
2025-08-30 09:33:14 +00:00
# Detect open windows/doors
2025-08-30 03:53:42 +00:00
open_entities : >
2025-08-30 09:28:10 +00:00
{% set list = [] %}
{% for ent_id in openings_list %}
{% set st = states(ent_id) %}
{% if st is not none and st.state == 'on' %}
{% set _ = list.append(st.attributes.friendly_name | default(ent_id)) %}
2025-08-30 09:16:34 +00:00
{% endif %}
{% endfor %}
2025-08-30 09:28:10 +00:00
{{ list }}
2025-08-30 09:33:14 +00:00
# Determine trigger info for message
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
{% else %}
Manual trigger
{% endif %}
# Filter conditions
2025-08-30 09:26:48 +00:00
weather_match : >
2025-08-30 09:33:14 +00:00
{% if trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
{{ current_weather in weather_states }}
{% else %}
true
{% endif %}
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) }}
2025-08-30 09:26:48 +00:00
{% else %}
2025-08-30 09:28:10 +00:00
true
2025-08-30 09:26:48 +00:00
{% endif %}
2025-08-30 09:09:00 +00:00
2025-08-30 09:26:48 +00:00
- choose :
- conditions :
- condition : template
2025-08-30 09:33:14 +00:00
value_template : "{{ open_entities | count > 0 and weather_match and temperature_match }}"
2025-08-30 09:26:48 +00:00
sequence :
2025-08-30 09:33:14 +00:00
- service : "{{ notify_service_name }}"
2025-08-30 09:28:10 +00:00
data :
message : >
2025-08-30 09:33:14 +00:00
{{ message_template
| replace('{{ entity_name }}', open_entities | join(', '))
| replace('{{ trigger_info }}', trigger_info)
}}