blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,50 +1,53 @@
|
||||
blueprint:
|
||||
name: Open Windows/Doors Notification (Debug)
|
||||
description: Debug blueprint to verify open windows/doors and notifications.
|
||||
name: Monitor Open Windows/Doors
|
||||
description: Shows all selected windows/doors that are currently open.
|
||||
domain: automation
|
||||
input:
|
||||
openings:
|
||||
name: Windows & Doors
|
||||
opening_devices:
|
||||
name: Window/Door Sensors
|
||||
description: Select the devices you want to monitor
|
||||
selector:
|
||||
entity:
|
||||
domain: binary_sensor
|
||||
device:
|
||||
integration: binary_sensor
|
||||
multiple: true
|
||||
notify_service:
|
||||
name: Notification Service
|
||||
default: notify.notify
|
||||
notification_target:
|
||||
name: Notification Target
|
||||
description: Where should the notification be sent?
|
||||
default: persistent_notification
|
||||
selector:
|
||||
text: {}
|
||||
custom_message:
|
||||
name: Custom Message Template
|
||||
default: "Open windows: {{ entity_name }}"
|
||||
selector:
|
||||
text: {}
|
||||
action:
|
||||
service: []
|
||||
|
||||
trigger:
|
||||
# Trigger when the state of a selected sensor changes
|
||||
- platform: state
|
||||
entity_id: !input openings
|
||||
entity_id: !input opening_devices
|
||||
|
||||
action:
|
||||
- variables:
|
||||
openings_list: !input openings
|
||||
notify_service_name: !input notify_service
|
||||
message_template: !input custom_message
|
||||
|
||||
open_entities: >
|
||||
{% set list = [] %}
|
||||
{% for ent_id in openings_list %}
|
||||
{% set st = states[ent_id] if ent_id in states else None %}
|
||||
{% if st is not none and st.state == 'on' %}
|
||||
{% set _ = list.append(st.attributes.friendly_name | default(ent_id)) %}
|
||||
open_devices: >
|
||||
{% set devices = [] %}
|
||||
{% for device in opening_devices %}
|
||||
{% if is_state(device, 'on') %}
|
||||
{% set _ = devices.append(states[device].name) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ list }}
|
||||
{{ devices }}
|
||||
|
||||
- service: "{{ notify_service_name }}"
|
||||
- choose:
|
||||
- conditions: "{{ open_devices | length > 0 }}"
|
||||
sequence:
|
||||
- service: !input notification_target
|
||||
data:
|
||||
message: >
|
||||
{% if open_entities | count > 0 %}
|
||||
{{ message_template | replace('{{ entity_name }}', open_entities | join(', ')) }}
|
||||
{% else %}
|
||||
No windows are open.
|
||||
{% endif %}
|
||||
Open windows/doors:
|
||||
{% for d in open_devices %}
|
||||
- {{ d }}
|
||||
{% endfor %}
|
||||
title: "Attention: Open Windows/Doors"
|
||||
- conditions: "{{ open_devices | length == 0 }}"
|
||||
sequence:
|
||||
- service: !input notification_target
|
||||
data:
|
||||
message: "All selected windows/doors are closed."
|
||||
title: "Window/Door Status"
|
||||
|
||||
Reference in New Issue
Block a user