Skip to content

Instantly share code, notes, and snippets.

@oddstr13
Last active January 18, 2024 22:06
Show Gist options
  • Save oddstr13/e4d931ad31932df92fd711678bb5a354 to your computer and use it in GitHub Desktop.
Save oddstr13/e4d931ad31932df92fd711678bb5a354 to your computer and use it in GitHub Desktop.
Alert on sensor level
blueprint:
name: Alert on sensor level
domain: automation
author: Odd Stråbø <[email protected]>
input:
sensor_name:
name: Name
selector:
text:
level_sensor:
name: Sensor
selector:
entity:
filter:
domain: sensor
level_value:
name: Value
selector:
number:
step: "any"
mode: "box"
update_frequency:
name: Update frequency
default: 10
selector:
number:
min: 1
max: 60
unit_of_measurement: min
variables:
sensor_name: !input sensor_name
update_frequency: !input update_frequency
level_sensor: !input level_sensor
level_value: !input level_value
description: ""
mode: single
trigger:
- platform: numeric_state
entity_id: !input level_sensor
below: !input level_value
- platform: time_pattern
minutes: "/{{ update_frequency }}"
seconds: "0"
hours: "*"
condition: []
action:
- if:
- condition: numeric_state
entity_id: !input level_sensor
below: !input level_value
then:
- service: persistent_notification.create
data:
message: "{{ sensor_name }} dropped below {{ level_value }}"
notification_id: "notif-{{ level_sensor }}-{{ level_value }}"
enabled: true
- service: notify.notify
data:
message: >-
{{ sensor_name }} is {{ states(level_sensor, with_unit=True) }}
data:
tag: "tag-{{ level_sensor }}-{{ level_value }}"
visibility: public
persistent: true
alert_once: true
else:
- service: persistent_notification.dismiss
data:
notification_id: "notif-{{ level_sensor }}-{{ level_value }}"
- service: notify.notify
data:
data:
tag: "tag-{{ level_sensor }}-{{ level_value }}"
message: clear_notification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment