blueprint: name: Open Windows/Doors Notification (Clean Working Version) description: Notify when windows or doors are open based on weather or temperature thresholds. Supports multiple notify services and multiple weather states. domain: automation input: openings: name: Windows & Doors selector: entity: domain: binary_sensor multiple: true weather_sensor: name: Weather Sensor selector: entity: domain: weather multiple: false weather_trigger_states: name: Weather Trigger States (comma-separated) default: storm,rain selector: text: {} temperature_sensor: name: Temperature Sensor selector: entity: domain: - sensor - weather device_class: temperature temp_above: name: Notify if Temperature Above default: 22 selector: number: min: -50 max: 50 unit_of_measurement: °C temp_below: name: Notify if Temperature Below default: 17 selector: number: min: -50 max: 50 unit_of_measurement: °C notify_services: name: Notification Services description: Comma-separated notify services (e.g., notify.mobile_app_phone,notify.alexa_media_livingroom) default: notify.notify selector: text: {} custom_message: name: Custom Message Template default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}" selector: text: {} trigger: - platform: state entity_id: !input weather_sensor - platform: numeric_state entity_id: !input temperature_sensor above: !input temp_above - platform: numeric_state entity_id: !input temperature_sensor below: !input temp_below action: - variables: # Inputs openings_list: !input openings raw_weather_states: !input weather_trigger_states raw_notify_services: !input notify_services 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 trigger_state: > {% if trigger.to_state is not none %} {{ trigger.to_state.state }} {% else %} unknown {% endif %} # Determine open windows/doors open_entities: > {% 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)) %} {% endif %} {% endfor %} {{ list }} # Determine if weather matches weather_match: > {% if trigger.entity_id == weather_sensor and states(weather_sensor) is not none %} {{ states(weather_sensor).state in weather_states }} {% else %} true {% endif %} - choose: - conditions: - condition: template value_template: "{{ open_entities | count > 0 and weather_match }}" sequence: - service: notify.all data: message: > {% set msg = custom_msg | replace('{{ entity_name }}', open_entities | join(', ')) | replace('{{ trigger_state }}', trigger_state) %} {{ msg }}