Photovoltaik Production per day

I’m trying to get my Photovoltaik production from the past day based on my persistence values. The values are stored each 2.5 seconds and the graph is looking fine.
In sum I produced approx 27 kw/h of energy which is confirmend by my device.
Now I’m struggling to get the same values out of the persistence.
Following rule is stored. Values are stored in w/h so they are divided by 1000 to get kw/h

rule "EMS Tag Durchschnittswerte"
        System started or
        Time cron "0 0/1 * * * ?" 
        val zoneddatetime =
        val production = E3DCPowerPlant_PhotovoltaikLeistung.sumSince(zoneddatetime) / 1000
        logInfo("EMS Daily","Production "+production)       


2021-07-09 19:34:00.222 [INFO ] [.openhab.core.model.script.EMS Daily] - Production 1729.92993333

The value 1730 kw/h per day is wrong!
Divide with 24 Hours the value is approx 70 kw/h per day which is wrong!

Please give me a hint how to calcuate the produced kw/H from the last 24h!

sumSince is not what you want, it adds up all persisted values. Note that is not the same as to calculate the integral which is what you want.
You could divide that sum by the number of persisted values, but would need to be sure how many values were summed up and you cannot be sure on that.
Use averageSince and multiply by the time interval. It does the time weighting for you.

PS: and you will probably not want to calculate that every minute