blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
blueprint:
|
||||
name: Open Windows/Doors Notification (Final Working Version)
|
||||
name: Open Windows/Doors Notification (Final Working)
|
||||
description: Notify when windows or doors are open based on weather or temperature thresholds. Supports multiple notify services and multiple weather states.
|
||||
domain: automation
|
||||
input:
|
||||
@@ -46,7 +46,6 @@ blueprint:
|
||||
unit_of_measurement: °C
|
||||
notify_services:
|
||||
name: Notification Services
|
||||
description: Comma-separated notify services (e.g., notify.mobile_app_phone,notify.alexa_media_livingroom)
|
||||
default: notify.notify
|
||||
selector:
|
||||
text: {}
|
||||
@@ -82,7 +81,6 @@ action:
|
||||
{{ 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: >
|
||||
{% set open_list = [] %}
|
||||
{% for ent_id in selected_openings %}
|
||||
@@ -92,18 +90,31 @@ action:
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ open_list }}
|
||||
# Determine if weather matches selected states
|
||||
weather_match: >
|
||||
{% if states(trigger.entity_id) is not none %}
|
||||
{{ states(trigger.entity_id).state in weather_trigger_states }}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
|
||||
- repeat:
|
||||
count: "{{ notify_services_list | count }}"
|
||||
sequence:
|
||||
- service: "{{ notify_services_list[repeat.index0] }}"
|
||||
data:
|
||||
message: >
|
||||
{% if open_entities | count > 0 %}
|
||||
{{ message_template
|
||||
| replace('{{ entity_name }}', open_entities | join(', '))
|
||||
| replace('{{ trigger_state }}', trigger_state)
|
||||
}}
|
||||
{% else %}
|
||||
No windows/doors open.
|
||||
{% endif %}
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ open_entities | count > 0 }}"
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.entity_id != None and (trigger.entity_id == temperature_sensor or weather_match) }}"
|
||||
sequence:
|
||||
- repeat:
|
||||
count: "{{ notify_services_list | count }}"
|
||||
sequence:
|
||||
- service: "{{ notify_services_list[repeat.index0] }}"
|
||||
data:
|
||||
message: >
|
||||
{{ message_template
|
||||
| replace('{{ entity_name }}', open_entities | join(', '))
|
||||
| replace('{{ trigger_state }}', trigger_state)
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user