Integrating an history stats into energy card

Hi, I’m lost in trying to visualize the estimate natural gas used for house heating basing on the hystory_stats sensor shown down here.

 - platform: history_stats
    name: Riscaldamento living oggi
    entity_id: switch.termoliving
    state: on
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'  

Here the history graph of the sensor

I tried to compute by hour but the sensor is not shown as eligible sensor for the energy page.

So, recap, how can show an hourly computed history stats into the energy monitor?
According to the previous attached graph I would get this…

Try this custom component:

Should cover your needs without creating a history stats sensor.

Thankyou, eventually I merged up all yours ideas and I managed in exstimate the cubic meters by invrementing a value by some logics via node red.

I measured the volume of gas used in one hour at different time during the day and so I derived a value ‘per 10 seconds’. So each ten seconds I push to home assistant the new calculated value.

In the first month I had a 12% delta, now, let check the next month.