blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -5,23 +5,29 @@ blueprint:
|
||||
input:
|
||||
openings:
|
||||
name: Windows & Doors
|
||||
description: Select windows and doors to monitor
|
||||
selector:
|
||||
entity:
|
||||
domain: binary_sensor
|
||||
multiple: true
|
||||
weather_sensor:
|
||||
name: Weather Sensor
|
||||
description: Optional weather entity to trigger notification
|
||||
default: []
|
||||
selector:
|
||||
entity:
|
||||
domain: weather
|
||||
multiple: false
|
||||
weather_trigger_states:
|
||||
name: Weather Trigger States (comma-separated)
|
||||
description: Notify when weather is in any of these states
|
||||
default: storm,rain
|
||||
selector:
|
||||
text:
|
||||
multiline: true
|
||||
text: {}
|
||||
temperature_sensor:
|
||||
name: Temperature Sensor
|
||||
description: Optional temperature entity to trigger notification
|
||||
default: []
|
||||
selector:
|
||||
entity:
|
||||
domain:
|
||||
@@ -59,8 +65,6 @@ blueprint:
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: !input weather_sensor
|
||||
# Cannot split in trigger, so we use a single state
|
||||
to: !input weather_trigger_states
|
||||
- platform: numeric_state
|
||||
entity_id: !input temperature_sensor
|
||||
above: !input temp_above
|
||||
@@ -78,9 +82,10 @@ action:
|
||||
selected_openings: !input openings
|
||||
message_template: !input custom_message
|
||||
notify_service_name: !input notify_service
|
||||
# Get only entities that are currently 'on'
|
||||
open_entities: >
|
||||
{{ states
|
||||
| selectattr('entity_id','in', selected_openings)
|
||||
{{ selected_openings
|
||||
| map('states')
|
||||
| selectattr('state','eq','on')
|
||||
| map(attribute='attributes.friendly_name')
|
||||
| list }}
|
||||
@@ -94,9 +99,11 @@ action:
|
||||
- service: "{{ notify_service_name }}"
|
||||
data:
|
||||
message: >
|
||||
{% for entity_name in open_entities %}
|
||||
{% if open_entities %}
|
||||
{{ message_template
|
||||
| replace('{{ entity_name }}', entity_name)
|
||||
| replace('{{ entity_name }}', open_entities | join(', '))
|
||||
| replace('{{ trigger_state }}', trigger_state)
|
||||
}}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
No windows/doors open.
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user