save floats instead of integers

Hi all,
I have the impression that all data saved on www.flukso.net is saved as integers?

I can see it from the difference in my water consumption numbers. I have a water leak with a flowrate of about 120 liter/day (thanks flukso for helping me detect it). However, when I download the data through the api, in lpermin, I get values of 0 all night long, and if I get it in lperday, I get values of 120 all night long. As 120 liter per day is equivalent to 0.08 liter per min, that could explain the difference.

Strangely, the visualisation on my dash shows graphically that the flow rate is not zero through the night, but when I hove the mouse over the graph, the values are always zero.

So for now I know that I should always use the liter per day data, as it gives me the highest precision. But it is very confusing. Did I do something wrong?

Regards,
Roel

icarus75's picture

For chart rendering we always use the kwhperyear and lperday units since they provide the highest resolution. The values are converted to the requested chart unit in the browser. A zero value in the mouse-over will be due to rounding.

Data on the server is stored as floats.

degerrit's picture

Just wanted to share a problem I was having with lpermin - but with the API, not the chart.

I've got a small vegetable garden (vierkante moestuin) which I like to water using a water-drip-system, attached to a normal faucet. Occasionally, I forget to turn it off again - and it has been watering overnight a few times now : what a waste!

Since Flukso is measuring my water use (100% accuracy!) - I made a leak-detection in a shell script, this script is then used by my 'Domotiga' automation system which sends me a mail, sms. So far so good.

Only problem was : I needed to know as early as possible, so I assumed lpermin would provide the best data for my API fetch script*. However, it provides integers and gave me 0 most of the time (actual use is about 0.5 liters per minute, 30l per hour).

Specifically my bash script compares the last 10, 20, and 30 minutes water use and checks whether that is nonzero and the equal (indicating a constant flow of water).

So following advice elsewhere here I'm no longer fetching lpermin but rather lperday, and then dividing the value (still requested/provided per minute!) by the 1440 minutes in every day.

Just wanted to share...

In hindsight, there's probably a way to get the data using MQTT from Flukso to Domotiga, and perform some magic in Domotiga itself - but right now that's way over my head!

- Gerrit

* Basically I'm using a PHP snippet from rzuman in my shell script, copied from https://www.flukso.net/content/getting-working-ajax-example

old:
https://api.flukso.net/sensor/c5fedba361c8630e408ca11dc8dc3027?resolutio...

new:
https://api.flukso.net/sensor/c5fedba361c8630e408ca11dc8dc3027?resolutio...