blueprint: name: Open Windows/Doors Notification (Final Working) 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 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: selected_openings: !input openings raw_weather_states: !input weather_trigger_states raw_notify_services: !input notify_services message_template: !input custom_message trigger_state: > {% if trigger.platform in ['numeric_state','state'] and trigger.to_state is not none %} {{ trigger.to_state.state }} {% else %} unknown {% endif %} weather_trigger_states: > {{ raw_weather_states.split(',') | map('trim') | list }} notify_services_list: > {{ raw_notify_services.split(',') | map('trim') | list }} open_entities: > {% set open_list = [] %} {% for ent_id in selected_openings %} {% set state_obj = states(ent_id) %} {% if state_obj is not none and state_obj.state == 'on' %} {% set _ = open_list.append(state_obj.attributes.friendly_name | default(ent_id)) %} {% endif %} {% endfor %} {{ open_list }} # 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 %} - 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) }}