How to create counter

Hi

I have watermeter and integrate it with HA. But how to create a counter which calculate usage in 5 minutes period of time? Now I have incremental every 30 sec.