2025-08-30 03:22:01 +00:00
|
|
|
blueprint:
|
2025-08-30 09:35:50 +00:00
|
|
|
name: Open Windows/Doors Notification
|
2025-08-30 09:36:59 +00:00
|
|
|
description: Notify when windows or doors are open, triggered by weather, temperature, or manual execution.
|
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
|
|
|
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
|
|
|
|
|
|
|
|
weather_states: "{{ raw_weather_states.split(',') | map('trim') | list }}"
|
|
|
|
|
|
2025-08-30 09:36:59 +00:00
|
|
|
# Detect currently open windows
|
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 %}
|
2025-08-30 09:36:59 +00:00
|
|
|
{% set st = states[ent_id] if ent_id in states else None %}
|
2025-08-30 09:28:10 +00:00
|
|
|
{% 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:36:59 +00:00
|
|
|
# Determine trigger info safely
|
2025-08-30 09:33:14 +00:00
|
|
|
trigger_info: >
|
2025-08-30 09:36:59 +00:00
|
|
|
{% 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
|
2025-08-30 09:33:14 +00:00
|
|
|
{% else %}
|
|
|
|
|
Manual trigger
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
2025-08-30 09:36:59 +00:00
|
|
|
# Weather match check
|
2025-08-30 09:26:48 +00:00
|
|
|
weather_match: >
|
2025-08-30 09:36:59 +00:00
|
|
|
{% if trigger is defined and trigger.platform == 'state' and trigger.entity_id == weather_sensor_id %}
|
|
|
|
|
{{ states[weather_sensor_id].state in weather_states }}
|
2025-08-30 09:33:14 +00:00
|
|
|
{% else %}
|
|
|
|
|
true
|
|
|
|
|
{% endif %}
|
2025-08-30 09:36:59 +00:00
|
|
|
|
|
|
|
|
# Temperature match check
|
2025-08-30 09:33:14 +00:00
|
|
|
temperature_match: >
|
2025-08-30 09:36:59 +00:00
|
|
|
{% 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 }}
|
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)
|
|
|
|
|
}}
|