blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,53 +1,57 @@
|
||||
blueprint:
|
||||
name: Monitor Open Windows/Doors
|
||||
description: Shows all selected windows/doors that are currently open.
|
||||
name: Open Windows/Doors Monitor
|
||||
description: Monitors selected windows/doors and lists the ones that are open.
|
||||
domain: automation
|
||||
input:
|
||||
opening_devices:
|
||||
opening_sensors:
|
||||
name: Window/Door Sensors
|
||||
description: Select the devices you want to monitor
|
||||
description: Select the sensors to monitor
|
||||
selector:
|
||||
entity:
|
||||
domain: binary_sensor
|
||||
multiple: true
|
||||
notification_target:
|
||||
name: Notification Target
|
||||
description: Where should the notification be sent?
|
||||
default: persistent_notification
|
||||
notify_service:
|
||||
name: Notification Service
|
||||
description: Service to send notifications
|
||||
default: persistent_notification.create
|
||||
selector:
|
||||
action:
|
||||
service: []
|
||||
action: {}
|
||||
|
||||
trigger:
|
||||
# Trigger when the state of any selected sensor changes
|
||||
- platform: state
|
||||
entity_id: !input opening_devices
|
||||
# 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_devices: >
|
||||
open_sensors: >
|
||||
{% set devices = [] %}
|
||||
{% for device in opening_devices %}
|
||||
{% if is_state(device, 'on') %}
|
||||
{% set _ = devices.append(states[device].name) %}
|
||||
{% for sensor in opening_sensors %}
|
||||
{% if is_state(sensor, 'on') %}
|
||||
{% set _ = devices.append(states[sensor].name) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ devices }}
|
||||
|
||||
- choose:
|
||||
- conditions: "{{ open_devices | length > 0 }}"
|
||||
- conditions: "{{ open_sensors | length > 0 }}"
|
||||
sequence:
|
||||
- service: !input notification_target
|
||||
- service: !input notify_service
|
||||
data:
|
||||
title: "Open Windows/Doors"
|
||||
message: >
|
||||
Open windows/doors:
|
||||
{% for d in open_devices %}
|
||||
The following windows/doors are open:
|
||||
{% for d in open_sensors %}
|
||||
- {{ d }}
|
||||
{% endfor %}
|
||||
title: "Attention: Open Windows/Doors"
|
||||
- conditions: "{{ open_devices | length == 0 }}"
|
||||
- conditions: "{{ open_sensors | length == 0 }}"
|
||||
sequence:
|
||||
- service: !input notification_target
|
||||
- service: !input notify_service
|
||||
data:
|
||||
message: "All selected windows/doors are closed."
|
||||
title: "Window/Door Status"
|
||||
message: "All selected windows/doors are closed."
|
||||
|
||||
Reference in New Issue
Block a user