Rolling power consumption

Hi, I would like to detect the power consumtion of the last hour. For example if in the last hour the consumption was higher than 3 kWh a switch will trigger. Actually I do monitor the current consumtion in Watts. But how can I realize a helper or sensor that always shows me the consumtion of the last hour?


# Example configuration.yaml entry
    source: sensor.energy_in_kwh
    cycle: hourly

Thanks, but I think that utility meter resets every hour at the same time. So it starts from 0 W every hour. What I would like is to have the consumtion of the last hour, any time. In theory this would never go to 0 W, because there is always a consumtion of at least 250 W in the house.