Hi,
I created a derivative sensor which derives my water counter sensor to see immediate water consumption in m3/hour.
It works,except one significant detail. Derivative sensor doesnt update when there is no update in the source sensor (which is expected behavior).
The result is the derivative never shows zero value. And this is a problem.
So my problem is that I need to update the source sensor periodically to trigger derivative sensor recalculation. I tried the trick with adding an attribute to the source/template sensor, but it does not trigger update.
Your attribute template only generates values between 0 and 5 so might this be the problem? I do know this works as I’m using this successfully in several places (not with derivative but with integration though).
Why not just use “{{ now() }}”?
Edit: wait! Do you have a trigger on your template-sensor? Won’t update otherwise. You should be able to see the result of you efforts in the “last_updated” attribute of your template-sensor in devtools.
Hello, I’m also having this issue and it is really annoying to have a false instant consumption value when the indexes from which this is calculated do not increase (which means instant consumption should be 0)
FlorianOosterhof apparently you made some work on this in your commit that was closed, could you resubmit it if it works ?
I think Florian’s PR may have addressed some other issues also, so he’d have to modify that PR to utilize the new event while keeping his other improvements.
Edit: there was also another PR merged in 2024.7 for the Riemann sum integration to add the max_sub_interval configuration option. We need that change as well for the derivative integration.