Daily power calculation with Shelly3em

So i got my power meter up and running,so now i have to learn how to calculate daily consumption and put it on a chart like i am doing with watts and volt usage using rrd4j and chart in Habpanel.Looking around i found some examples but cant make the calculation work right.

Items
Number:Energy  Energy_today          "Energy_today"  ( Group_HabPanel_Dashboard,gEnergy )
Number:Energy  Shelly_EM3_consumption          "Shelly_EM3_consumption" ( Group_HabPanel_Dashboard,gEnergy )

I take my acumulatedenergytotal item and at every change i find the difference between the now and the previous value and postupdate with that my Shelly_EM3_consumption item.That works well!

rule "Power Consumption em3"
when
    Item GreenHousePowerMeter_AccumulatedTotal changed
then
    Shelly_EM3_consumption.postUpdate((GreenHousePowerMeter_AccumulatedTotal.state as QuantityType<Energy>) - (previousState as QuantityType<Energy>))
end

so now we take the Shelly_EM3_consumption value and sum it every time its updated and postupdate the result to a new item Energy_today .

rule "Power Consumption em3 today"
when    
    Item Shelly_EM3_consumption received update
then
    var today = Shelly_EM3_consumption.sumSince(now().with(LocalTime.MIDNIGHT))
    Energy_today.postUpdate(today)
end

the value i get for the Energy_today item is

2021-12-03 20:27:02.963 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GreenHousePowerMeter_AccumulatedTotal' changed from 26.976 kWh to 26.991 kWh
2021-12-03 20:27:02.976 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Energy_today' changed from 0.016 kWh to 0.015 kWh

what am i doing wrong ?Any ideas?

In rule “Power Consumption em3” why don’t you simply cumulate the difference of
GreenHousePowerMeter_AccumulatedTotal - previousState
to the item Energy_today?
i.e.

Energy_today.postUpdate(Energy_today.state + GreenHousePowerMeter_AccumulatedTotal - previousState)