# Calculate Gallons per minute (from Gallons)

Hello All,

I am working building a device handler for a water meter using a Z-Wave device that supports the PULSE METER command class. The device sends me the pulse total, from which I can calculate the total number of gallons, but what would be the best way to calculate the Gallons per Minute? This is a much more useful figure.

I could write a function that would run once per minute and compare the last two gallon values, but since all of the scheduled events are dependent on the cloud, this seems like it would be a bad idea (give the ST history with timeliness of events). Does anybody have any ideas for the best way to accomplish this?

Thanks,

Dan Kurin

Couldnâ€™t you just compute gallons/min based on time between pulse totals.

timeElapsedInMin = currentPulseTimeInMin - lastPulseTimeInMin
gallonsUsed = currentGallons - lastPulseGallons
gallons/min = gallonsUsed/timeElapsedInMin

2 Likes

Thanks @Ron, this is really smart. At that point I could set a â€śtimeoutâ€ť RunIn() that would write GPM to 0 after 5 or 10 minutes, but the timing would be less critical.

Thanks!

@dantheman2865 sorry for the n00b question? but how can you compute the water usage? Meaning the hardware involved.

Thanks!

@Squares This guy sends out a pulse for each gallon that passes through it:

http://www.ekmmetering.com/3-4-water-meter-stainless-steel-pulse-output.html

The MIMOlite device accumulates the pulses and sends out a total every time it gets another pulse.

Gotcha!! [20 characters]