blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,59 +1,106 @@
|
|||||||
blueprint:
|
blueprint:
|
||||||
name: Open Windows/Doors Monitor
|
name: Open Windows/Doors Notification
|
||||||
description: Monitors selected windows/doors and lists the ones that are open.
|
description: Notify when windows or doors are open based on weather state or temperature thresholds.
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
opening_sensors:
|
openings:
|
||||||
name: Window/Door Sensors
|
name: Windows & Doors
|
||||||
description: Select the sensors to monitor
|
description: Select windows and doors to monitor
|
||||||
selector:
|
selector:
|
||||||
entity:
|
entity:
|
||||||
domain: binary_sensor
|
domain: binary_sensor
|
||||||
multiple: true
|
multiple: true
|
||||||
notify_services:
|
weather_sensor:
|
||||||
name: Notification Services
|
name: Weather Sensor
|
||||||
description: Enter notify services separated by commas, e.g. notify.mobile_app_phone,notify.telegram
|
description: Optional weather entity to trigger notification
|
||||||
default: notify.notify
|
selector:
|
||||||
|
entity:
|
||||||
|
domain: weather
|
||||||
|
weather_trigger_states:
|
||||||
|
name: Weather Trigger States
|
||||||
|
description: Select weather states that should trigger notification
|
||||||
|
default:
|
||||||
|
- storm
|
||||||
|
- rain
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
|
multiline: true
|
||||||
|
temperature_sensor:
|
||||||
|
name: Temperature Sensor
|
||||||
|
description: Optional temperature entity to trigger notification
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
domain:
|
||||||
|
- sensor
|
||||||
|
- weather
|
||||||
|
device_class: temperature
|
||||||
|
temp_above:
|
||||||
|
name: Notify if Temperature Above
|
||||||
|
description: Optional threshold to trigger notification
|
||||||
|
default: 22
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: -50
|
||||||
|
max: 50
|
||||||
|
unit_of_measurement: °C
|
||||||
|
temp_below:
|
||||||
|
name: Notify if Temperature Below
|
||||||
|
description: Optional threshold to trigger notification
|
||||||
|
default: 17
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: -50
|
||||||
|
max: 50
|
||||||
|
unit_of_measurement: °C
|
||||||
|
notify_target:
|
||||||
|
name: Notification Target
|
||||||
|
selector:
|
||||||
|
target: {}
|
||||||
|
custom_message:
|
||||||
|
name: Custom Notification Message
|
||||||
|
default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}"
|
||||||
|
selector:
|
||||||
|
text: {}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: !input opening_sensors
|
entity_id: !input weather_sensor
|
||||||
|
to: "{{ !input weather_trigger_states.split(',') | map('trim') | list }}"
|
||||||
|
- platform: numeric_state
|
||||||
|
entity_id: !input temperature_sensor
|
||||||
|
above: !input temp_above
|
||||||
|
- platform: numeric_state
|
||||||
|
entity_id: !input temperature_sensor
|
||||||
|
below: !input temp_below
|
||||||
|
|
||||||
|
condition:
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input openings
|
||||||
|
state: 'on'
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- variables:
|
- variables:
|
||||||
open_sensors: >
|
selected_openings: !input openings
|
||||||
{% set devices = [] %}
|
selected_temp_sensor: !input temperature_sensor
|
||||||
{% for sensor in opening_sensors %}
|
selected_weather: !input weather_sensor
|
||||||
{% if is_state(sensor, 'on') or is_state(sensor, 'open') %}
|
selected_notify_target: !input notify_target
|
||||||
{% set _ = devices.append(states[sensor].name) %}
|
selected_custom_message: !input custom_message
|
||||||
|
open_entities: >
|
||||||
|
{{ states | selectattr('entity_id','in',selected_openings) | selectattr('state','eq','on') | map(attribute='attributes.friendly_name') | list }}
|
||||||
|
trigger_state: >
|
||||||
|
{% if trigger.platform in ['numeric_state','state'] %}
|
||||||
|
{{ trigger.to_state.state }}
|
||||||
|
{% else %}
|
||||||
|
unknown
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
|
||||||
notify_list: >
|
|
||||||
{% set services = !input notify_services | replace(' ', '') | split(',') %}
|
|
||||||
{{ services }}
|
|
||||||
|
|
||||||
- choose:
|
- service: notify.notify
|
||||||
- conditions: "{{ open_sensors | length > 0 }}"
|
|
||||||
sequence:
|
|
||||||
- repeat:
|
|
||||||
count: "{{ notify_list | length }}"
|
|
||||||
sequence:
|
|
||||||
- service: "{{ notify_list[repeat.index0] }}"
|
|
||||||
data:
|
data:
|
||||||
title: "Open Windows/Doors"
|
target: "{{ selected_notify_target }}"
|
||||||
message: >
|
message: >
|
||||||
The following windows/doors are open:
|
{% for entity_name in open_entities %}
|
||||||
{% for d in open_sensors %}
|
{{ selected_custom_message
|
||||||
- {{ d }}
|
| replace('{{ entity_name }}', entity_name)
|
||||||
|
| replace('{{ trigger_state }}', trigger_state)
|
||||||
|
}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
- conditions: "{{ open_sensors | length == 0 }}"
|
|
||||||
sequence:
|
|
||||||
- repeat:
|
|
||||||
count: "{{ notify_list | length }}"
|
|
||||||
sequence:
|
|
||||||
- service: "{{ notify_list[repeat.index0] }}"
|
|
||||||
data:
|
|
||||||
title: "Window/Door Status"
|
|
||||||
message: "All selected windows/doors are closed."
|
|
||||||
|
|||||||
Reference in New Issue
Block a user