Files
hass-blueprints/blueprints/automation/wd-close-weather-notification.yaml

54 lines
1.5 KiB
YAML

blueprint:
name: Monitor Open Windows/Doors
description: Shows all selected windows/doors that are currently open.
domain: automation
input:
opening_devices:
name: Window/Door Sensors
description: Select the devices you want to monitor
selector:
device:
integration: binary_sensor
multiple: true
notification_target:
name: Notification Target
description: Where should the notification be sent?
default: persistent_notification
selector:
action:
service: []
trigger:
# Trigger when the state of a selected sensor changes
- platform: state
entity_id: !input opening_devices
action:
- variables:
open_devices: >
{% set devices = [] %}
{% for device in opening_devices %}
{% if is_state(device, 'on') %}
{% set _ = devices.append(states[device].name) %}
{% endif %}
{% endfor %}
{{ devices }}
- choose:
- conditions: "{{ open_devices | length > 0 }}"
sequence:
- service: !input notification_target
data:
message: >
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"