58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
blueprint:
|
|
name: Open Windows/Doors Monitor
|
|
description: Monitors selected windows/doors and lists the ones that are open.
|
|
domain: automation
|
|
input:
|
|
opening_sensors:
|
|
name: Window/Door Sensors
|
|
description: Select the sensors to monitor
|
|
selector:
|
|
entity:
|
|
domain: binary_sensor
|
|
multiple: true
|
|
notify_service:
|
|
name: Notification Service
|
|
description: Service to send notifications
|
|
default: persistent_notification.create
|
|
selector:
|
|
action: {}
|
|
|
|
trigger:
|
|
# Template trigger that fires when any selected sensor changes
|
|
- platform: template
|
|
value_template: >
|
|
{% for sensor in opening_sensors %}
|
|
{% if is_state(sensor, 'on') %}
|
|
true
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
action:
|
|
- variables:
|
|
open_sensors: >
|
|
{% set devices = [] %}
|
|
{% for sensor in opening_sensors %}
|
|
{% if is_state(sensor, 'on') %}
|
|
{% set _ = devices.append(states[sensor].name) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ devices }}
|
|
|
|
- choose:
|
|
- conditions: "{{ open_sensors | length > 0 }}"
|
|
sequence:
|
|
- service: !input notify_service
|
|
data:
|
|
title: "Open Windows/Doors"
|
|
message: >
|
|
The following windows/doors are open:
|
|
{% for d in open_sensors %}
|
|
- {{ d }}
|
|
{% endfor %}
|
|
- conditions: "{{ open_sensors | length == 0 }}"
|
|
sequence:
|
|
- service: !input notify_service
|
|
data:
|
|
title: "Window/Door Status"
|
|
message: "All selected windows/doors are closed."
|