Get energy consumption in utility_meter between dates

Hi
My Utility_meter are well working. Energy dashbard too !
I’m finding a tip to get a cunsumption of one of my utility_meter between 2 dates.
This is possible because we can do it in the energy dashboard but I’d like to have it in a sensor.

The goal is to get from the now date year -1 at the end of the year.
Eg now we’re the 2024 02 12.
I’d like to have the total energy from 2023 02 12 to 2023 12 31
It’s to simulate the cost of future energy with new provider price :kissing: