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 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.
|
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,6 @@ blueprint:
|
|||||||
unit_of_measurement: °C
|
unit_of_measurement: °C
|
||||||
notify_services:
|
notify_services:
|
||||||
name: Notification Services
|
name: Notification Services
|
||||||
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: {}
|
||||||
@@ -82,7 +81,6 @@ action:
|
|||||||
{{ raw_weather_states.split(',') | map('trim') | list }}
|
{{ raw_weather_states.split(',') | map('trim') | list }}
|
||||||
notify_services_list: >
|
notify_services_list: >
|
||||||
{{ raw_notify_services.split(',') | map('trim') | 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 %}
|
||||||
@@ -92,18 +90,31 @@ action:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ open_list }}
|
{{ 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 %}
|
||||||
|
|
||||||
|
- 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:
|
- repeat:
|
||||||
count: "{{ notify_services_list | count }}"
|
count: "{{ notify_services_list | count }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: "{{ notify_services_list[repeat.index0] }}"
|
- service: "{{ notify_services_list[repeat.index0] }}"
|
||||||
data:
|
data:
|
||||||
message: >
|
message: >
|
||||||
{% if open_entities | count > 0 %}
|
|
||||||
{{ message_template
|
{{ message_template
|
||||||
| replace('{{ entity_name }}', open_entities | join(', '))
|
| replace('{{ entity_name }}', open_entities | join(', '))
|
||||||
| replace('{{ trigger_state }}', trigger_state)
|
| replace('{{ trigger_state }}', trigger_state)
|
||||||
}}
|
}}
|
||||||
{% else %}
|
|
||||||
No windows/doors open.
|
|
||||||
{% endif %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user