History Statistics Sensor - 4 hours rolling?

Hi all.
I have a sensor connected to my outdoor heatpump, so I can see when it is on. I also have a History Statistics Sensor showing how many hours it’s been on the last day.

I would really like another History Statistics Sensor showing how many minutes it has been running for just the last 4 hours. I simply cannot figure out how to do that. Can anyone offer me some help?
TIA!

/ole

I feel like I’m not understanding something here. Why can’t you use the history statistics component with

type: time
end: '{{ now() }}'
duration: '04:00'

If the value is in hours, just multiply by 60 to get minutes. You’ll probably need another template sensor to do the math.

No, I think you understand it perfectly - this was all I was looking for! I was just not clever enough to figure out, how to format it.

Thanks you very much!

/ole

Ah, good to hear!