Integral calculation sensor

Hello everybody, hope you are all doing well. I am new to the channel and hopefully doing everything right ;-).

I am currently in integrating my analogue watermeter into HA with this project GitHub - jomjol/AI-on-the-edge-device from Github. Everything is working and the MQTT sensors provide the value all 5 minutes. The data is already stored within a MariaDB and the recorder settings have been changed.

With this data I am happy but what I am looking for is the possibility to calculate the integrale values for the last day from 00:00 to 24:00 (not last 24 hours).
I checked the history_stats integration already which would be fine with regards to the timeframe but this doesn’t allow numeric values whereas the statistics monitor allows numeric values but the timeframe only the last 24 hours.

Do you guys have any smart idea to combine both. My goal is to have a bar graph with 365 entries and the water consumption. Is there any better way of doing that and I may unnecessarily think too complex? Thanks for your inputs.