Has anyone figured out a way to get the same or similar functionality in ESPHome? My use case can’t depend on home assistant so the logic needs to reside in the ESP.
That’s not a trend. That’s comparing an absolute value.
A trend is comparing the slope of a trend line… and when the slope is detected, the binary sensor goes TRUE.
Derivatives. Integrals. Area under the curve. Uggggg. I should have stayed awake in my advanced calculus classes in college 35 years ago. My dog ate my homework…
Someone who doesn’t have a dog who ate their homework could probably write a lambda! My advanced math skills are looong gone. That’s why math libraries were created!
@nickrout I agree, there must be a library out there somewhere.
Yes but you need something saving the last sensor value to compare it to the current one to establish a slope. Or the last 10 sensor values, or whatever accuracy you want.
Interesting. I’d have to wrap my pea-sized brain around that code.
In my head I see this pseudo code: Store a bunch of samples (10) round robin FIFO style in an array and do math on the samples in the bucket after each new sample arrives. If the math checks out (the slope is up or down or flat) set a binary sensor or better yet, text global to 'heating/idle/cooling"
Translating that to ESPHome code is a different story.