How to get energy of last hour

Hello, i would like to get my last hour energy used of my sensor (Shelly EM) who is recording the power used from my house. reason of that is well setup the custom:tesla-style-solar-power-card.

with following code i get the total value from the beginning of the recording… how to get the last hours?

thak you all in advance

template:
  - sensor:
    - name: 'Daily Energy Total'
      device_class: energy
      unit_of_measurement: kWh
      state: >
        {{ states('sensor.monit_casa_e_fotovoltaico_channel_1_energy') | float }}

I’d recommend to use Utility Meter with an hourly reset
Utility Meter - Home Assistant (home-assistant.io)
EDIT: modifying my answer as it depends a bit what you want to do with the data…

thanks to support.
i would like to ha sensor (to link it later on in a chart) which collect the amout of energy used “today”. so it has to reset it every day… I saw already the utility_meter but is not clear how to implemented it.

utility_meter:
  energy:
    source: sensor.energy_in_kwh
    cycle: monthly

cycle: daily