2025-08-30 03:22:01 +00:00
blueprint :
2025-08-30 09:28:10 +00:00
name : Open Windows/Doors Notification (Clean Working Version)
2025-08-30 09:23:07 +00:00
description : Notify when windows or doors are open based on weather or temperature thresholds. Supports multiple notify services and multiple weather states.
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:23:07 +00:00
notify_services :
name : Notification Services
2025-08-30 09:28:10 +00:00
description : Comma-separated notify services (e.g., notify.mobile_app_phone,notify.alexa_media_livingroom)
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 03:57:58 +00:00
default : "{{ entity_name }} is open! Trigger: {{ trigger_state }}"
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:25:08 +00:00
raw_weather_states : !input weather_trigger_states
raw_notify_services : !input notify_services
2025-08-30 09:28:10 +00:00
custom_msg : !input custom_message
# Processed lists
weather_states : "{{ raw_weather_states.split(',') | map('trim') | list }}"
notify_services_list : "{{ raw_notify_services.split(',') | map('trim') | list }}"
# Current trigger state
2025-08-30 09:20:18 +00:00
trigger_state : >
2025-08-30 09:28:10 +00:00
{% if trigger.to_state is not none %}
2025-08-30 09:20:18 +00:00
{{ trigger.to_state.state }}
{% else %}
unknown
{% endif %}
2025-08-30 09:28:10 +00:00
# Determine 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 }}
# Determine if weather matches
2025-08-30 09:26:48 +00:00
weather_match : >
2025-08-30 09:28:10 +00:00
{% if trigger.entity_id == weather_sensor and states(weather_sensor) is not none %}
{{ states(weather_sensor).state in weather_states }}
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:28:10 +00:00
value_template : "{{ open_entities | count > 0 and weather_match }}"
2025-08-30 09:26:48 +00:00
sequence :
2025-08-30 09:28:10 +00:00
- service : notify.all
data :
message : >
{% set msg = custom_msg | replace('{{ entity_name }}', open_entities | join(', ')) | replace('{{ trigger_state }}', trigger_state) %}
{{ msg }}