blueprint: name: "Open Windows/Doors Weather Notification" description: >- Sends notifications when windows/doors are open during specific weather conditions or temperature thresholds. domain: automation source_url: https://github.com/yourusername/hass-blueprints input: windows_doors: name: Windows & Doors description: Select all windows and doors to monitor selector: entity: domain: binary_sensor device_class: - door - window - opening multiple: true required: true notify_service: name: Notification Service description: The notification service to use (e.g., notify.mobile_app_phone) selector: text: weather_entity: name: Weather Entity description: Weather entity to monitor (e.g., weather.home) selector: entity: domain: weather weather_states: name: Trigger Weather States description: Notify when weather changes to any of these states selector: select: multiple: true mode: list options: - label: Clear Night value: clear-night - label: Cloudy value: cloudy - label: Exceptional value: exceptional - label: Fog value: fog - label: Hail value: hail - label: Lightning value: lightning - label: Rainy value: rainy - label: Snowy value: snowy - label: Sunny value: sunny - label: Windy value: windy default: ["rainy", "snowy"] temperature_sensor: name: Temperature Sensor description: Temperature sensor to monitor selector: entity: domain: sensor device_class: temperature temp_high: name: High Temperature (°C) description: Notify if temperature exceeds this value default: 25 selector: number: min: -20 max: 50 step: 0.5 unit_of_measurement: °C mode: box temp_low: name: Low Temperature (°C) description: Notify if temperature drops below this value default: 10 selector: number: min: -20 max: 50 step: 0.5 unit_of_measurement: °C mode: box trigger: # Weather state change - platform: state entity_id: !input 'weather_entity' id: weather_change # Temperature high - platform: numeric_state entity_id: !input 'temperature_sensor' above: !input 'temp_high' id: temp_high_trigger # Temperature low - platform: numeric_state entity_id: !input 'temperature_sensor' below: !input 'temp_low' id: temp_low_trigger condition: # Check if any window/door is open - condition: or conditions: >- [ {% for entity in windows_doors %} { "condition": "state", "entity_id": "{{ entity }}", "state": "on" }{% if not loop.last %},{% endif %} {% endfor %} ] action: - variables: open_entities: >- [ {% for entity in windows_doors %} {% if is_state(entity, 'on') %} "{{ state_attr(entity, 'friendly_name') or entity }}"{% if not loop.last %},{% endif %} {% endif %} {% endfor %} ] open_count: '{{ open_entities | count }}' - choose: - conditions: - condition: trigger id: weather_change - condition: template value_template: >- {{ state_attr(trigger.entity_id, 'state') in weather_states }} sequence: - service: !input 'notify_service' data: message: >- Weather is {{ state_attr(trigger.entity_id, 'state') }} and {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }} title: "🌤️ Openings Alert" - conditions: - condition: trigger id: temp_high_trigger sequence: - service: !input 'notify_service' data: message: >- Temperature is {{ states(temperature_sensor) | float | round(1) }}°C and {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }} title: "🌡️ High Temperature Alert" - conditions: - condition: trigger id: temp_low_trigger sequence: - service: !input 'notify_service' data: message: >- Temperature is {{ states(temperature_sensor) | float | round(1) }}°C and {{ open_count }} opening(s) are open: {{ open_entities | join(', ') }} title: "❄️ Low Temperature Alert" mode: queued max: 10 value: clear-night - label: Cloudy value: cloudy - label: Exceptional value: exceptional - label: Fog value: fog - label: Hail value: hail - label: Lightning value: lightning - label: Lightning Rainy value: lightning-rainy - label: Partly Cloudy value: partlycloudy - label: Pouring value: pouring - label: Rainy value: rainy - label: Snowy value: snowy - label: Snowy Rainy value: snowy-rainy - label: Sunny value: sunny - label: Windy value: windy - label: Windy Variant value: windy-variant default: ["rainy", "pouring", "snowy"] # Temperature Trigger Section temperature_sensor: name: Temperature Sensor description: Temperature sensor to monitor (e.g., sensor.outside_temperature) selector: entity: domain: sensor device_class: temperature required: false temp_high_threshold: name: High Temperature Threshold description: Notify if temperature exceeds this value selector: number: min: -20 max: 50 step: 0.5 unit_of_measurement: °C mode: box default: 25 temp_low_threshold: name: Low Temperature Threshold description: Notify if temperature drops below this value selector: number: min: -20 max: 50 step: 0.5 unit_of_measurement: °C mode: box default: 10 temp_high_threshold: name: High Temperature (°C) description: Temperature above which to send notifications default: 25 selector: number: min: -20 max: 50 step: 0.5 unit_of_measurement: °C mode: box temp_low_threshold: name: Low Temperature (°C) description: Temperature below which to send notifications default: 10 selector: number: min: -20 max: 50 step: 0.5 unit_of_measurement: °C mode: box trigger: # Weather state change trigger - platform: state entity_id: !input 'weather_entity' id: weather_change # Temperature triggers - platform: numeric_state entity_id: !input 'temperature_sensor' above: !input 'temp_high_threshold' id: temp_high - platform: numeric_state entity_id: !input 'temperature_sensor' below: !input 'temp_low_threshold' id: temp_low condition: # Check if any of the monitored openings are open - condition: or conditions: >- {% for entity in windows_doors %} - condition: state entity_id: '{{ entity }}' state: 'on' {% endfor %} action: - variables: open_entities: >- {% set open = namespace(items=[]) %} {% for entity in windows_doors %} {% if is_state(entity, 'on') %} {% set _ = open.items.append(states[entity].name) %} {% endif %} {% endfor %} {{ open.items }} open_count: '{{ open_entities | length }}' - choose: - conditions: - condition: trigger id: weather_change - condition: template value_template: >- {{ state_attr(trigger.entity_id, 'weather_state') in weather_states }} sequence: - service: notify.notify target: !input 'notification_target' data: message: >- Weather alert: {{ state_attr(trigger.entity_id, 'weather_state') | title }} detected with {{ open_count }} opening(s) open: {{ open_entities | join(', ') }} title: "🌤️ Openings Alert" - conditions: - condition: trigger id: temp_high sequence: - service: notify.notify target: !input 'notification_target' data: message: >- 🌡️ High temperature ({{ states(temperature_sensor) | float | round(1) }}°C) detected with {{ open_count }} opening(s) open: {{ open_entities | join(', ') }} title: "🌡️ High Temperature Alert" - conditions: - condition: trigger id: temp_low sequence: - service: notify.notify target: !input 'notification_target' data: message: >- ❄️ Low temperature ({{ states(temperature_sensor) | float | round(1) }}°C) detected with {{ open_count }} opening(s) open: {{ open_entities | join(', ') }} title: "❄️ Low Temperature Alert" mode: queued max: 10