2025-08-30 03:22:01 +00:00
blueprint :
2025-08-30 09:26:48 +00:00
name : Open Windows/Doors Notification (Final Working)
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: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:09:00 +00:00
selected_openings : !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:09:00 +00:00
message_template : !input custom_message
2025-08-30 09:20:18 +00:00
trigger_state : >
2025-08-30 09:21:40 +00:00
{% if trigger.platform in ['numeric_state','state'] and 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:25:08 +00:00
weather_trigger_states : >
{{ raw_weather_states.split(',') | map('trim') | list }}
notify_services_list : >
{{ raw_notify_services.split(',') | map('trim') | list }}
2025-08-30 03:53:42 +00:00
open_entities : >
2025-08-30 09:16:34 +00:00
{% set open_list = [] %}
{% for ent_id in selected_openings %}
{% set state_obj = states(ent_id) %}
2025-08-30 09:20:18 +00:00
{% if state_obj is not none and state_obj.state == 'on' %}
2025-08-30 09:18:46 +00:00
{% set _ = open_list.append(state_obj.attributes.friendly_name | default(ent_id)) %}
2025-08-30 09:16:34 +00:00
{% endif %}
{% endfor %}
{{ open_list }}
2025-08-30 09:26:48 +00:00
# Determine if weather matches selected states
weather_match : >
{% if states(trigger.entity_id) is not none %}
{{ states(trigger.entity_id).state in weather_trigger_states }}
{% else %}
false
{% endif %}
2025-08-30 09:09:00 +00:00
2025-08-30 09:26:48 +00:00
- choose :
- conditions :
- condition : template
value_template : "{{ open_entities | count > 0 }}"
sequence :
- choose :
- conditions :
- condition : template
value_template : "{{ trigger.entity_id != None and (trigger.entity_id == temperature_sensor or weather_match) }}"
sequence :
- repeat :
count : "{{ notify_services_list | count }}"
sequence :
- service : "{{ notify_services_list[repeat.index0] }}"
data :
message : >
{{ message_template
| replace('{{ entity_name }}', open_entities | join(', '))
| replace('{{ trigger_state }}', trigger_state)
}}