214 lines
5.9 KiB
YAML
214 lines
5.9 KiB
YAML
blueprint:
|
|
name: "Open Windows/Doors Weather Notification"
|
|
description: >-
|
|
Sends notifications when windows/doors are open during specific weather conditions
|
|
or temperature thresholds.
|
|
domain: automation
|
|
input:
|
|
windows_doors:
|
|
name: Windows & Doors
|
|
description: Select all windows and doors to monitor
|
|
selector:
|
|
entity:
|
|
integration: binary_sensor
|
|
domain: binary_sensor
|
|
device_class:
|
|
- door
|
|
- window
|
|
- opening
|
|
multiple: true
|
|
|
|
notification_target:
|
|
name: Notification Target
|
|
description: The notification target (e.g., mobile_app_phone)
|
|
selector:
|
|
target: {}
|
|
|
|
# Weather Trigger Section
|
|
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: 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
|