blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
blueprint:
|
blueprint:
|
||||||
name: Open Windows/Doors Notification (Final)
|
name: Open Windows/Doors Notification (Final Working Version)
|
||||||
description: Notify when windows or doors are open based on weather or temperature thresholds. Supports multiple notify services and multiple weather states.
|
description: Notify when windows or doors are open based on weather or temperature thresholds. Supports multiple notify services and multiple weather states.
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
@@ -46,7 +46,7 @@ blueprint:
|
|||||||
unit_of_measurement: °C
|
unit_of_measurement: °C
|
||||||
notify_services:
|
notify_services:
|
||||||
name: Notification Services
|
name: Notification Services
|
||||||
description: Enter one or multiple notify services (comma-separated)
|
description: Comma-separated notify services (e.g., notify.mobile_app_phone,notify.alexa_media_livingroom)
|
||||||
default: notify.notify
|
default: notify.notify
|
||||||
selector:
|
selector:
|
||||||
text: {}
|
text: {}
|
||||||
@@ -69,18 +69,20 @@ trigger:
|
|||||||
action:
|
action:
|
||||||
- variables:
|
- variables:
|
||||||
selected_openings: !input openings
|
selected_openings: !input openings
|
||||||
weather_trigger_states: >-
|
raw_weather_states: !input weather_trigger_states
|
||||||
{{ !input weather_trigger_states.split(',') | map('trim') | list }}
|
raw_notify_services: !input notify_services
|
||||||
message_template: !input custom_message
|
message_template: !input custom_message
|
||||||
notify_services_list: >-
|
|
||||||
{{ !input notify_services.split(',') | map('trim') | list }}
|
|
||||||
trigger_state: >
|
trigger_state: >
|
||||||
{% if trigger.platform in ['numeric_state','state'] and trigger.to_state is not none %}
|
{% if trigger.platform in ['numeric_state','state'] and trigger.to_state is not none %}
|
||||||
{{ trigger.to_state.state }}
|
{{ trigger.to_state.state }}
|
||||||
{% else %}
|
{% else %}
|
||||||
unknown
|
unknown
|
||||||
{% endif %}
|
{% endif %}
|
||||||
# Build list of open windows/doors
|
weather_trigger_states: >
|
||||||
|
{{ raw_weather_states.split(',') | map('trim') | list }}
|
||||||
|
notify_services_list: >
|
||||||
|
{{ raw_notify_services.split(',') | map('trim') | list }}
|
||||||
|
# Build list of currently open windows/doors
|
||||||
open_entities: >
|
open_entities: >
|
||||||
{% set open_list = [] %}
|
{% set open_list = [] %}
|
||||||
{% for ent_id in selected_openings %}
|
{% for ent_id in selected_openings %}
|
||||||
@@ -91,10 +93,10 @@ action:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ open_list }}
|
{{ open_list }}
|
||||||
|
|
||||||
- service: >
|
- repeat:
|
||||||
{% for srv in notify_services_list %}
|
count: "{{ notify_services_list | count }}"
|
||||||
{{ srv }}
|
sequence:
|
||||||
{% endfor %}
|
- service: "{{ notify_services_list[repeat.index0] }}"
|
||||||
data:
|
data:
|
||||||
message: >
|
message: >
|
||||||
{% if open_entities | count > 0 %}
|
{% if open_entities | count > 0 %}
|
||||||
|
|||||||
Reference in New Issue
Block a user