blueprints/automation/wd-close-weather-notification.yaml aktualisiert
This commit is contained in:
@@ -10,37 +10,23 @@ blueprint:
|
||||
entity:
|
||||
domain: binary_sensor
|
||||
multiple: true
|
||||
temperature_sensors:
|
||||
name: Temperature sensors
|
||||
description: Temperature sensors to check
|
||||
temperature_sensor:
|
||||
name: Temperature Sensor
|
||||
description: Select a temperature sensor or weather entity
|
||||
selector:
|
||||
entity:
|
||||
domain: sensor
|
||||
multiple: true
|
||||
temperature_cold_threshold:
|
||||
name: Cold Temperature Threshold
|
||||
description: Notify if temperature drops below this value
|
||||
default: 15
|
||||
selector:
|
||||
number:
|
||||
min: -50
|
||||
max: 50
|
||||
unit_of_measurement: °C
|
||||
temperature_hot_threshold:
|
||||
name: Hot Temperature Threshold
|
||||
description: Notify if temperature rises above this value
|
||||
default: 28
|
||||
selector:
|
||||
number:
|
||||
min: -50
|
||||
max: 50
|
||||
unit_of_measurement: °C
|
||||
weather_sensor:
|
||||
name: Weather sensor
|
||||
description: Sensor reporting weather conditions
|
||||
filter:
|
||||
domain:
|
||||
- sensor
|
||||
- weather
|
||||
device_class:
|
||||
- temperature
|
||||
weather_entity:
|
||||
name: Weather Forecast Entity
|
||||
description: Select a weather forecast entity
|
||||
selector:
|
||||
entity:
|
||||
domain: sensor
|
||||
domain: weather
|
||||
bad_weather_states:
|
||||
name: Bad Weather States
|
||||
description: List of weather states that should trigger a notification
|
||||
@@ -51,12 +37,12 @@ blueprint:
|
||||
text:
|
||||
multiline: true
|
||||
notify_target:
|
||||
name: Notification target
|
||||
name: Notification Target
|
||||
description: Who to notify
|
||||
selector:
|
||||
target: {}
|
||||
min_open_time:
|
||||
name: Minimum open time
|
||||
name: Minimum Open Time
|
||||
description: Duration in minutes before notifying
|
||||
default: 20
|
||||
selector:
|
||||
@@ -81,28 +67,25 @@ trigger:
|
||||
action:
|
||||
- variables:
|
||||
current_temp: >
|
||||
{{ states(!input.temperature_sensors) | map(attribute='state') | map('float') | min }}
|
||||
current_condition: >
|
||||
{% if current_temp < !input.temperature_cold_threshold %}
|
||||
too cold
|
||||
{% elif current_temp > !input.temperature_hot_threshold %}
|
||||
too hot
|
||||
{% if is_state_attr(!input.temperature_sensor, 'temperature', none) %}
|
||||
{{ state_attr(!input.temperature_sensor, 'temperature') }}
|
||||
{% else %}
|
||||
{{ states(!input.temperature_sensor) | map(attribute='state') | map('float') | min }}
|
||||
{% endif %}
|
||||
current_condition: >
|
||||
{% set states_list = !input.bad_weather_states.split(',') | map('trim') %}
|
||||
{% if states(!input.weather_sensor) | string in states_list %}
|
||||
{% if states(!input.weather_entity) | string in states_list %}
|
||||
bad weather
|
||||
{% else %}
|
||||
unknown
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
- service: notify.notify
|
||||
data:
|
||||
target: "{{ !input 'notify_target' }}"
|
||||
target: "{{ !input.notify_target }}"
|
||||
message: >
|
||||
{{ !input.custom_message
|
||||
| replace('{{ entity_name }}', states(trigger.entity_id).attributes.friendly_name)
|
||||
| replace('{{ temperature }}', current_temp | string)
|
||||
| replace('{{ condition }}', current_condition)
|
||||
}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user