I want to trigger an automation if a sensor value increases very fast, i.e. it goes from 20 to 60 within a few minutes. Is this possible?
You should define rapid first, let’s say change in value by 20 units in a minute.
- create a number input helper, we will store previous value here
- create a minute based automation
- check if previous value minus new value is above threshold 20.
- if yes, fire the actual event
- update input helper with new value
Home Assistant has many useful utility integrations, this is one Trend - Home Assistant
Or just use the trend binary sensor with min_gradient: 0.22
calculated using (60-20)/(3*60), you may need to adjust this.
Just beat ya!
I spent too long calculating the minimum gradient.
I spent too long staring at the utilities page trying to remember which one to use
Thank you guys, the Trend sensor is perfect.
One question left: I want to track for example if the sensor goes from 20 to 60 within 200s seconds. That is an inclination of 40/200=0.2
But I don’t want to track if the sensor goes from 20 to 22 within 10s. So besides an inclination of 0.2 units/second this should be the case for at least 100 seconds. How can I catch this?
Your initial post indicated this was for an automation.
You could try a for: 200
in the trigger.
I kept circling back to the Filter integration, re-reading the Time Moving Averages Filter and thinking “Nah, that’s not it.” Couldn’t remember it was the Trend integration. Next time I’ll zero in on the Oddballs Utilities category.
I created a Derivative Sensor, which to me is a bit more straight forward.