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