Calculate hourly water consumption from cumulative_sum() in one Query (InfluxDB)

Hello all,

I am trying to solve the issue with the water consumption calculation. I am using influxDB as a data source where I am colecting the water pulses. One pulse means 10 liters of water. It looks like this:

And using the cumulative_sum() I get this cumulated value per time interval:

What I wanna to do is to calculate the hourly consumptions from the cumulation above, for example water consumption from 8:00 to 9:00, 9:00 to 10:00 etc.

Could someone please help me with this if it is possible?

Thank you.

What happens if you change the query to be GROUP BY time (1h)?

If I change the GROUP BY time to (1h) instead of (1s) it shows 0 value. Maybe because I am reading the pulses from PLC and they lasts 1 second.