blueprints/automation/wd-close-weather-notification.yaml aktualisiert

This commit is contained in:
2025-08-30 10:38:22 +00:00
parent a2ce440d60
commit 55b81776e3

View File

@@ -55,7 +55,8 @@ blueprint:
notify_target: notify_target:
name: Notification Target name: Notification Target
selector: selector:
target: {} entity:
domain: notify
custom_message: custom_message:
name: Custom Notification Message name: Custom Notification Message
default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}" default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}"
@@ -79,20 +80,11 @@ condition:
state: 'on' state: 'on'
action: action:
- variables: - service: "[[[ return !input.notify_target ]]]"
open_entities: >
{% set openings = states.binary_sensor | selectattr('entity_id', 'in', !input openings) | selectattr('state', 'eq', 'on') | map(attribute='attributes.friendly_name') | list %}
{% if openings | length > 0 %}
{{ openings }}
{% else %}
[]
{% endif %}
- if: "{{ open_entities | length > 0 }}"
then:
- service: notify.notify
data: data:
target: !input notify_target
message: > message: >
{% set open_entities = states.binary_sensor | selectattr('entity_id', 'in', !input.openings) | selectattr('state', 'eq', 'on') | map(attribute='attributes.friendly_name') | list %}
{% if open_entities | length > 0 %}
{% set trigger_state = 'Unknown' %} {% set trigger_state = 'Unknown' %}
{% if trigger.platform == 'numeric_state' %} {% if trigger.platform == 'numeric_state' %}
{% if trigger.above is defined %} {% if trigger.above is defined %}
@@ -110,3 +102,4 @@ action:
{% set message_parts = message_parts + [msg | replace('{{ entity_name }}', entity_name)] %} {% set message_parts = message_parts + [msg | replace('{{ entity_name }}', entity_name)] %}
{% endfor %} {% endfor %}
{{ message_parts | join("\n") }} {{ message_parts | join("\n") }}
{% endif %}