blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -5,23 +5,24 @@ blueprint:
|
||||
or temperature thresholds.
|
||||
domain: automation
|
||||
input:
|
||||
openings:
|
||||
windows_doors:
|
||||
name: Windows & Doors
|
||||
description: Select all windows and doors to monitor
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
domain: binary_sensor
|
||||
device_class:
|
||||
- door
|
||||
- window
|
||||
- opening
|
||||
entity:
|
||||
integration: binary_sensor
|
||||
domain: binary_sensor
|
||||
device_class:
|
||||
- door
|
||||
- window
|
||||
- opening
|
||||
multiple: true
|
||||
|
||||
notify_service:
|
||||
name: Notification Service
|
||||
description: The notification service to use (e.g., notify.mobile_app_phone)
|
||||
notification_target:
|
||||
name: Notification Target
|
||||
description: The notification target (e.g., mobile_app_phone)
|
||||
selector:
|
||||
text:
|
||||
target: {}
|
||||
|
||||
# Weather Trigger Section
|
||||
weather_entity:
|
||||
@@ -30,7 +31,6 @@ blueprint:
|
||||
selector:
|
||||
entity:
|
||||
domain: weather
|
||||
required: false
|
||||
|
||||
weather_states:
|
||||
name: Trigger Weather States
|
||||
@@ -38,22 +38,38 @@ blueprint:
|
||||
selector:
|
||||
select:
|
||||
multiple: true
|
||||
mode: list
|
||||
options:
|
||||
- clear-night
|
||||
- cloudy
|
||||
- exceptional
|
||||
- fog
|
||||
- hail
|
||||
- lightning
|
||||
- lightning-rainy
|
||||
- partlycloudy
|
||||
- pouring
|
||||
- rainy
|
||||
- snowy
|
||||
- snowy-rainy
|
||||
- sunny
|
||||
- windy
|
||||
- windy-variant
|
||||
- label: Clear Night
|
||||
value: clear-night
|
||||
- label: Cloudy
|
||||
value: cloudy
|
||||
- label: Exceptional
|
||||
value: exceptional
|
||||
- label: Fog
|
||||
value: fog
|
||||
- label: Hail
|
||||
value: hail
|
||||
- label: Lightning
|
||||
value: lightning
|
||||
- label: Lightning Rainy
|
||||
value: lightning-rainy
|
||||
- label: Partly Cloudy
|
||||
value: partlycloudy
|
||||
- label: Pouring
|
||||
value: pouring
|
||||
- label: Rainy
|
||||
value: rainy
|
||||
- label: Snowy
|
||||
value: snowy
|
||||
- label: Snowy Rainy
|
||||
value: snowy-rainy
|
||||
- label: Sunny
|
||||
value: sunny
|
||||
- label: Windy
|
||||
value: windy
|
||||
- label: Windy Variant
|
||||
value: windy-variant
|
||||
default: ["rainy", "pouring", "snowy"]
|
||||
|
||||
# Temperature Trigger Section
|
||||
@@ -90,41 +106,68 @@ blueprint:
|
||||
mode: box
|
||||
default: 10
|
||||
|
||||
temp_high_threshold:
|
||||
name: High Temperature (°C)
|
||||
description: Temperature above which to send notifications
|
||||
default: 25
|
||||
selector:
|
||||
number:
|
||||
min: -20
|
||||
max: 50
|
||||
step: 0.5
|
||||
unit_of_measurement: °C
|
||||
mode: box
|
||||
|
||||
temp_low_threshold:
|
||||
name: Low Temperature (°C)
|
||||
description: Temperature below which to send notifications
|
||||
default: 10
|
||||
selector:
|
||||
number:
|
||||
min: -20
|
||||
max: 50
|
||||
step: 0.5
|
||||
unit_of_measurement: °C
|
||||
mode: box
|
||||
|
||||
trigger:
|
||||
# Weather state change trigger
|
||||
- platform: state
|
||||
entity_id: !input weather_entity
|
||||
entity_id: !input 'weather_entity'
|
||||
id: weather_change
|
||||
if: |
|
||||
{{ is_state_attr(trigger.entity_id, 'state', '') == false }}
|
||||
|
||||
# Temperature triggers
|
||||
- platform: numeric_state
|
||||
entity_id: !input temperature_sensor
|
||||
above: !input temp_high_threshold
|
||||
entity_id: !input 'temperature_sensor'
|
||||
above: !input 'temp_high_threshold'
|
||||
id: temp_high
|
||||
|
||||
- platform: numeric_state
|
||||
entity_id: !input temperature_sensor
|
||||
below: !input temp_low_threshold
|
||||
entity_id: !input 'temperature_sensor'
|
||||
below: !input 'temp_low_threshold'
|
||||
id: temp_low
|
||||
|
||||
condition:
|
||||
# Check if any of the monitored openings are open
|
||||
- condition: or
|
||||
conditions:
|
||||
conditions: >-
|
||||
{% for entity in windows_doors %}
|
||||
- condition: state
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
entity_id: '{{ entity }}'
|
||||
state: 'on'
|
||||
for: '00:00:05'
|
||||
{% endfor %}
|
||||
|
||||
action:
|
||||
- variables:
|
||||
open_entities: >
|
||||
{{ expand('binary_sensor') | selectattr('state', 'eq', 'on') |
|
||||
selectattr('entity_id', 'in', input_openings.entity) |
|
||||
map(attribute='name') | list }}
|
||||
open_count: "{{ open_entities | length }}"
|
||||
open_entities: >-
|
||||
{% set open = namespace(items=[]) %}
|
||||
{% for entity in windows_doors %}
|
||||
{% if is_state(entity, 'on') %}
|
||||
{% set _ = open.items.append(states[entity].name) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ open.items }}
|
||||
open_count: '{{ open_entities | length }}'
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
@@ -132,35 +175,39 @@ action:
|
||||
id: weather_change
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{{ state_attr(trigger.entity_id, 'state') in input_weather_states }}
|
||||
{{ state_attr(trigger.entity_id, 'weather_state') in weather_states }}
|
||||
sequence:
|
||||
- service: "{{ input.notify_service }}"
|
||||
- service: notify.notify
|
||||
target: !input 'notification_target'
|
||||
data:
|
||||
message: >-
|
||||
Weather alert: {{ state_attr(trigger.entity_id, 'state') | title }}
|
||||
Weather alert: {{ state_attr(trigger.entity_id, 'weather_state') | title }}
|
||||
detected with {{ open_count }} opening(s) open: {{ open_entities | join(', ') }}
|
||||
title: "Openings Alert"
|
||||
title: "🌤️ Openings Alert"
|
||||
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: temp_high
|
||||
sequence:
|
||||
- service: "{{ input.notify_service }}"
|
||||
- service: notify.notify
|
||||
target: !input 'notification_target'
|
||||
data:
|
||||
message: >-
|
||||
High temperature ({{ states(input.temperature_sensor) }}°C) detected
|
||||
🌡️ High temperature ({{ states(temperature_sensor) | float | round(1) }}°C) detected
|
||||
with {{ open_count }} opening(s) open: {{ open_entities | join(', ') }}
|
||||
title: "High Temperature Alert"
|
||||
title: "🌡️ High Temperature Alert"
|
||||
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: temp_low
|
||||
sequence:
|
||||
- service: "{{ input.notify_service }}"
|
||||
- service: notify.notify
|
||||
target: !input 'notification_target'
|
||||
data:
|
||||
message: >-
|
||||
Low temperature ({{ states(input.temperature_sensor) }}°C) detected
|
||||
❄️ Low temperature ({{ states(temperature_sensor) | float | round(1) }}°C) detected
|
||||
with {{ open_count }} opening(s) open: {{ open_entities | join(', ') }}
|
||||
title: "Low Temperature Alert"
|
||||
title: "❄️ Low Temperature Alert"
|
||||
|
||||
mode: single
|
||||
mode: queued
|
||||
max: 10
|
||||
|
||||
Reference in New Issue
Block a user