Notified when a value changes more or less than 10%

Hi,
I’ve got a sensor which tracks a certain value, that changes every 5 minutes.
I’m looking for a way to get notified at the moment the value changes more than 10%.

is there a quick way to do this?

Automation. Entity state trigger, template condition.

trigger:
  - platform: state
    entity_id: sensor.YOUR_SENSOR
condition:
  - condition: template
    value_template: "{{ not(0.9 < (trigger.from_state.state|float / trigger.to_state.state|float) < 1.1 }}"
action:
  NOTIFY STUFF HERE

That will only fire if a single update changes the state by more than 10%. It won’t fire if it slowly drifts over a number of updates.

Thx for the suggestion. What do you mean with the last line? So it only triggers when the value changes at that moment with 10 procent, right?
Hm not sure if this happens in such short time. I guess its not possible to add a time element? So for instance trigger only when the change is 10% or more in the last 24 hours.

That’s a different question, and probably a job for one of these:

See the examples.

1 Like