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