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