I took a look at your code and found
where the data type is a floating point. I think you meant to utilize the variable as an integer type. So, instead of double
try uint32_t or unsigned long
@Rftop has posted a Not tested, but this might get you started: example in another thread. It is not a solution for your particular question but I mention it because the example presented is easy to read and follow. While looking at it I discovered the data type issue above.
https://community.particle.io/t/having-trouble-with-flow-meter-still-showing-value-when-not-running/43578/5