83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
blueprint:
|
|
name: Open Windows/Doors Weather & Temperature Notification
|
|
description: Notify when windows or doors are open during bad weather or extreme temperatures, with a customizable message.
|
|
domain: automation
|
|
input:
|
|
openings:
|
|
name: Windows & Doors
|
|
description: Select windows and doors to monitor
|
|
selector:
|
|
entity:
|
|
domain: binary_sensor
|
|
multiple: true
|
|
temperature_sensor:
|
|
name: Temperature Sensor
|
|
description: Select a temperature sensor
|
|
selector:
|
|
entity:
|
|
domain: sensor
|
|
device_class: temperature
|
|
weather_entity:
|
|
name: Weather Forecast Entity
|
|
description: Select a weather forecast entity
|
|
selector:
|
|
entity:
|
|
domain: weather
|
|
bad_weather_states:
|
|
name: Bad Weather States
|
|
description: List of weather states that should trigger a notification
|
|
default:
|
|
- storm
|
|
- rain
|
|
selector:
|
|
text:
|
|
multiline: true
|
|
notify_target:
|
|
name: Notification Target
|
|
description: Who to notify
|
|
selector:
|
|
target: {}
|
|
min_open_time:
|
|
name: Minimum Open Time
|
|
description: Duration in minutes before notifying
|
|
default: 20
|
|
selector:
|
|
number:
|
|
min: 1
|
|
max: 120
|
|
unit_of_measurement: minutes
|
|
custom_message:
|
|
name: Custom Notification Message
|
|
description: Use {{ entity_name }}, {{ temperature }}, and {{ condition }} as placeholders
|
|
default: "{{ entity_name }} is open! Condition: {{ condition }}, Current temperature: {{ temperature }}°C"
|
|
selector:
|
|
text: {}
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: !input openings
|
|
to: 'on'
|
|
for:
|
|
minutes: !input min_open_time
|
|
|
|
action:
|
|
- variables:
|
|
current_temp: "{{ states(!input.temperature_sensor) | map(attribute='state') | map('float') | min }}"
|
|
current_condition: >
|
|
{% set states_list = !input.bad_weather_states.split(',') | map('trim') %}
|
|
{% if states(!input.weather_entity) | string in states_list %}
|
|
bad weather
|
|
{% else %}
|
|
unknown
|
|
{% endif %}
|
|
|
|
- service: notify.notify
|
|
data:
|
|
target: "{{ !input.notify_target }}"
|
|
message: >
|
|
{{ !input.custom_message
|
|
| replace('{{ entity_name }}', states(trigger.entity_id).attributes.friendly_name)
|
|
| replace('{{ temperature }}', current_temp | string)
|
|
| replace('{{ condition }}', current_condition)
|
|
}}
|