Start-Offset for Integration - Riemann sum integral

Hello,

Is there any way to assign a starting value at the Integration - Riemann sum integral. As soon as I enter a value, it is reset at the next update.

Any idea?

No there is no provision for that. What are you trying to accomplish?

My old Riemann had a meter reading. Now I have programmed something different and the Riemann starts again at 0. I would like to enter the old counter reading there again.

Otherwise I would have to solve this with a template.

1 Like

Hello. The question is: how to write “0” to the integral Riemann sum sensor? Reset it. Or is it still impossible?

I have a very similar problem as described by Tomac84. I do realize the topic is quite old already, but I hope a solution is known by now (I just can’t seem to find it).

I calculate the power produced by my heat pump and I use the integrator to calculate the total amount of heat energy produced.

I changed the calculations slightly, but now the new integrator starts counting from 0. I would like the new integrator to continue with the value from the previous integrator. So basically I would like to give a “starting value” or “offset” to the new integrator.

I tried manually changing states and statistics within the Development tools (no luck, this updates only one single value and falls back immediately after).

I even tried to alter the database using SQLITE3 (adding the desired start value to the state values in the states table and in the statistics tables), but when I start home assistant again, it still continues with the new value.

Is there a solution known for this?

I think a template sensor that simply adds whatever offset you want to the integral helper is your best bet. Could even use another helper to make it easier to change this offset, if that’s something you see needing to do more than once.

I will go for the template sensor solution.

Thanks.

A Utility Meter helper may be easier. It can be set up from the UI and has a calibrate service you can use to set the value to anything in Developer tools → Services.

Hello.
I spent a lot of time finding out how to set Riemann sum integral template sensor to a specific value.
Reason why it is needed (in my case): source sensor output a false, very high number which corrupted my Riemann sum integral sensor value (increased it a LOT) and also Utility meters. I want to correct it.

Workaround:

  1. create a helper (type : template), which will simulate your source sensor (in my case sesnsor of electric power)
  2. set it as source sensor for the Riemann sum template sensor
  3. set value of the helper: you can use negative value for decreasing the Riemann sum entity (tempate: e.g. {{0-10000}} ) or positive value for increasing the Riemann sum entity (tempate: e.g. {{10000}} ).
  4. Watch how the Riemann sum entity changes and edit the helper value accordingly
  5. when you are satisfied with the Riemann sum value, set the helper to {{0}} to hold the Riemann sum value
  6. set back the original source entity of the Riemman sum entity

Note: utility meter can be set manually via service calibration