For your consideration, here’s one way to achieve your goal using existing features.
Using Manual Customization, define new attributes for the sensors that you wish to monitor. The following example adds tolerance_max
and tolerance_min
to three sensors.
sensor.first:
tolerance_max: 90
tolerance_min: 60
sensor.second:
tolerance_max: 10
tolerance_min: 5
sensor.third:
tolerance_max: 200
tolerance_min: 50
Create an automation that reports when the value of one of the three sensors is not within its tolerance levels.
alias: Out of tolerance
mode: queued
variables:
t_max: "{{ state_attr(trigger.entity_id, 'tolerance_max') }}"
t_min: "{{ state_attr(trigger.entity_id, 'tolerance_min') }}"
val: "{{ trigger.to_state.state | float(0) }}"
trigger:
- platform: state
entity_id:
- sensor.first
- sensor.second
- sensor.third
condition:
- condition: template
value_template: "{{ not t_min < val < t_max }}"
action:
- service: notify.persistent_notification
data:
title: "{{ trigger.entity_id }} is out of tolerance."
message: "Value: {{ val }}, Range: {{ t_min }}, {{t_max }}"