blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
blueprint:
|
blueprint:
|
||||||
name: Open Windows/Doors Weather & Temperature Notification (Weather Trigger)
|
name: Open Windows/Doors Notification (Clean)
|
||||||
description: Notify when windows or doors are open during bad weather or extreme temperatures, triggered by weather or temperature changes.
|
description: Notify when windows or doors are open based on weather state or temperature thresholds.
|
||||||
domain: automation
|
domain: automation
|
||||||
input:
|
input:
|
||||||
openings:
|
openings:
|
||||||
@@ -10,106 +10,95 @@ blueprint:
|
|||||||
entity:
|
entity:
|
||||||
domain: binary_sensor
|
domain: binary_sensor
|
||||||
multiple: true
|
multiple: true
|
||||||
temperature_sensor:
|
weather_sensor:
|
||||||
name: Temperature Sensor
|
name: Weather Sensor
|
||||||
description: Select a temperature sensor or weather entity
|
description: Optional weather entity to trigger notification
|
||||||
selector:
|
|
||||||
entity:
|
|
||||||
filter:
|
|
||||||
domain:
|
|
||||||
- sensor
|
|
||||||
- weather
|
|
||||||
device_class:
|
|
||||||
- temperature
|
|
||||||
temperature_cold_threshold:
|
|
||||||
name: Cold Temperature Threshold
|
|
||||||
default: 15
|
|
||||||
selector:
|
|
||||||
number:
|
|
||||||
min: -50
|
|
||||||
max: 50
|
|
||||||
unit_of_measurement: °C
|
|
||||||
temperature_hot_threshold:
|
|
||||||
name: Hot Temperature Threshold
|
|
||||||
default: 28
|
|
||||||
selector:
|
|
||||||
number:
|
|
||||||
min: -50
|
|
||||||
max: 50
|
|
||||||
unit_of_measurement: °C
|
|
||||||
weather_entity:
|
|
||||||
name: Weather Forecast Entity
|
|
||||||
selector:
|
selector:
|
||||||
entity:
|
entity:
|
||||||
domain: weather
|
domain: weather
|
||||||
bad_weather_states:
|
weather_trigger_states:
|
||||||
name: Bad Weather States
|
name: Weather Trigger States
|
||||||
|
description: Select weather states that should trigger notification
|
||||||
default:
|
default:
|
||||||
- storm
|
- storm
|
||||||
- rain
|
- rain
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
multiline: true
|
multiline: true
|
||||||
|
temperature_sensor:
|
||||||
|
name: Temperature Sensor
|
||||||
|
description: Optional temperature entity to trigger notification
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
domain:
|
||||||
|
- sensor
|
||||||
|
- weather
|
||||||
|
device_class: temperature
|
||||||
|
temp_above:
|
||||||
|
name: Notify if Temperature Above
|
||||||
|
description: Optional threshold to trigger notification
|
||||||
|
default: 24
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: -50
|
||||||
|
max: 50
|
||||||
|
unit_of_measurement: °C
|
||||||
|
temp_below:
|
||||||
|
name: Notify if Temperature Below
|
||||||
|
description: Optional threshold to trigger notification
|
||||||
|
default: 15
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: -50
|
||||||
|
max: 50
|
||||||
|
unit_of_measurement: °C
|
||||||
notify_target:
|
notify_target:
|
||||||
name: Notification Target
|
name: Notification Target
|
||||||
selector:
|
selector:
|
||||||
target: {}
|
target: {}
|
||||||
min_open_time:
|
|
||||||
name: Minimum Open Time
|
|
||||||
default: 20
|
|
||||||
selector:
|
|
||||||
number:
|
|
||||||
min: 1
|
|
||||||
max: 120
|
|
||||||
unit_of_measurement: minutes
|
|
||||||
custom_message:
|
custom_message:
|
||||||
name: Custom Notification Message
|
name: Custom Notification Message
|
||||||
default: "{{ entity_name }} is open! Condition: {{ condition }}, Current temperature: {{ temperature }}°C"
|
default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}"
|
||||||
selector:
|
selector:
|
||||||
text: {}
|
text: {}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
|
# Trigger for weather states
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: !input weather_entity
|
entity_id: !input weather_sensor
|
||||||
- platform: state
|
to: "{{ !input weather_trigger_states.split(',') | map('trim') | list }}"
|
||||||
|
# Trigger for temperature above
|
||||||
|
- platform: numeric_state
|
||||||
entity_id: !input temperature_sensor
|
entity_id: !input temperature_sensor
|
||||||
|
above: !input temp_above
|
||||||
|
# Trigger for temperature below
|
||||||
|
- platform: numeric_state
|
||||||
|
entity_id: !input temperature_sensor
|
||||||
|
below: !input temp_below
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
- condition: template
|
- condition: state
|
||||||
value_template: >
|
entity_id: !input openings
|
||||||
{% set cold_threshold = !input.temperature_cold_threshold %}
|
state: 'on'
|
||||||
{% set hot_threshold = !input.temperature_hot_threshold %}
|
|
||||||
{% set bad_states = !input.bad_weather_states.split(',') | map('trim') %}
|
|
||||||
{% set current_temp = states(!input.temperature_sensor) | float(0) %}
|
|
||||||
{% set current_weather = states(!input.weather_entity) %}
|
|
||||||
{% set condition_met = (current_temp < cold_threshold) or (current_temp > hot_threshold) or (current_weather in bad_states) %}
|
|
||||||
{% set any_open = states | selectattr('entity_id','in',!input.openings) | selectattr('state','eq','on') | list | length > 0 %}
|
|
||||||
{{ condition_met and any_open }}
|
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- variables:
|
- variables:
|
||||||
cold_threshold: !input temperature_cold_threshold
|
|
||||||
hot_threshold: !input temperature_hot_threshold
|
|
||||||
current_temp: "{{ states(!input.temperature_sensor) | float(0) }}"
|
|
||||||
current_weather: "{{ states(!input.weather_entity) }}"
|
|
||||||
bad_states: "{{ !input.bad_weather_states.split(',') | map('trim') }}"
|
|
||||||
condition_text: >
|
|
||||||
{% if current_temp < cold_threshold %}too cold
|
|
||||||
{% elif current_temp > hot_threshold %}too hot
|
|
||||||
{% elif current_weather in bad_states %}bad weather
|
|
||||||
{% else %}unknown
|
|
||||||
{% endif %}
|
|
||||||
open_entities: >
|
open_entities: >
|
||||||
{{ states | selectattr('entity_id','in',!input.openings) | selectattr('state','eq','on') | map(attribute='attributes.friendly_name') | list }}
|
{{ states | selectattr('entity_id','in',!input.openings) | selectattr('state','eq','on') | map(attribute='attributes.friendly_name') | list }}
|
||||||
|
trigger_state: >
|
||||||
|
{% if trigger.platform == 'numeric_state' %}
|
||||||
|
{{ trigger.to_state.state }}
|
||||||
|
{% else %}
|
||||||
|
{{ trigger.to_state.state }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
- service: notify.notify
|
- service: notify.notify
|
||||||
data:
|
data:
|
||||||
target: "{{ !input.notify_target }}"
|
target: "{{ !input notify_target }}"
|
||||||
message: >
|
message: >
|
||||||
{% for entity_name in open_entities %}
|
{% for entity_name in open_entities %}
|
||||||
{{ !input.custom_message
|
{{ !input custom_message
|
||||||
| replace('{{ entity_name }}', entity_name)
|
| replace('{{ entity_name }}', entity_name)
|
||||||
| replace('{{ temperature }}', current_temp | string)
|
| replace('{{ trigger_state }}', trigger_state)
|
||||||
| replace('{{ condition }}', condition_text)
|
|
||||||
}}
|
}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user