Blockly or script - how to get sum of item since now to date

OK, maybe i should tell the complete story:
I want to calculate my energy use and my energy infeed, because Shelly 3EM don’t calculate the energy balanced.
Here is my blockly script to save the average of the item: use and infeed:


This script i run with crone-job every 1 hour.
And now i only want to get the sum of this saved items.

Since 1 Week, i start to store this data.
But for the future i want a rule that store that data like my energy vendor do, maybe from:
31.08.2021 to 31.08.2022.
So i can see every day what my energy use/infeed is (the bill for the year is…)