blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -5,13 +5,14 @@ blueprint:
|
||||
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: Enter the notify service (e.g., notify.mobile_app_phone)
|
||||
notify_services:
|
||||
name: Notification Services
|
||||
description: Enter notify services separated by commas, e.g. notify.mobile_app_phone,notify.telegram
|
||||
default: notify.notify
|
||||
selector:
|
||||
text:
|
||||
@@ -25,26 +26,34 @@ action:
|
||||
open_sensors: >
|
||||
{% set devices = [] %}
|
||||
{% for sensor in opening_sensors %}
|
||||
{% if is_state(sensor, 'on') %}
|
||||
{% if is_state(sensor, 'on') or is_state(sensor, 'open') %}
|
||||
{% set _ = devices.append(states[sensor].name) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ devices }}
|
||||
notify_list: >
|
||||
{% set services = !input notify_services | replace(' ', '') | split(',') %}
|
||||
{{ services }}
|
||||
|
||||
- choose:
|
||||
- conditions: "{{ open_sensors | length > 0 }}"
|
||||
sequence:
|
||||
- service: "{{ notify_service }}"
|
||||
data:
|
||||
title: "Open Windows/Doors"
|
||||
message: >
|
||||
The following windows/doors are open:
|
||||
{% for d in open_sensors %}
|
||||
- {{ d }}
|
||||
{% endfor %}
|
||||
- repeat:
|
||||
count: "{{ notify_list | length }}"
|
||||
sequence:
|
||||
- service: "{{ notify_list[repeat.index0] }}"
|
||||
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: "{{ notify_service }}"
|
||||
data:
|
||||
title: "Window/Door Status"
|
||||
message: "All selected windows/doors are closed."
|
||||
- repeat:
|
||||
count: "{{ notify_list | length }}"
|
||||
sequence:
|
||||
- service: "{{ notify_list[repeat.index0] }}"
|
||||
data:
|
||||
title: "Window/Door Status"
|
||||
message: "All selected windows/doors are closed."
|
||||
|
||||
Reference in New Issue
Block a user