Summary of powerconsumption in openhab

that is exaclty what I want to do but I am not very good regarding the rules so help would really be appriciated.

Maybe you can send me your rule - i think this would be a rule I coud also use for my shellies as they lose their total value every time I make an update.

BR

I am also not the best in thisā€¦ i also did it with try and error and google researchā€¦

And i have to reengineer this functionā€¦ :wink:

But here you are - these are my rules for counting and resetting of the counter:
ā€œWP_reset_kwh_counterā€ is a boolian value on an external device (Wago SPS)

rule "Daily Power Consumption"
when
    Time cron "0 59 23 ? * * *"
    //Item Waermepumpe_HT changed
    then 
    val summary = Waermepumpe_HT.sumSince(now.minusDays(1), "jdbc") /60 /1000
    Heatpump_total_kwh_daily.postUpdate(summary.toString)
end

rule "Daily Power Counter store and reset"
when
    Time is midnight
    then
    Waermepumpe_sum_midnight.postUpdate(Waermepumpe_sum.state)
    WP_reset_kwh_counter.sendCommand(ON)
    createTimer(now.plusMillis(1000), [ |
        WP_reset_kwh_counter.sendCommand(OFF)
    ])
end```

 Waermepumpe_sum_midnight is the value which i am writing to an influxDB and jdbc out of OpenHab.

thank you - this helps a lot.

BR