API Help, current Kwh

Using the flukso.net api, what is the best way to calculate kWh used in the current day and month?

My thought is to call:
https://api.flukso.net/sensor/?unit=watt&version=1.0&interval=day&resolution=day
returns:
[[1329091200,916]]

So with 916 being the average for the day I would calculate the kWh like:

916 * 24 / 1000

To get the total current month kWh, I was thinking of calling
https://api.flukso.net/sensor/?unit=watt&version=1.0&start=timestamp&resolution=day

Then calculating the total for each day as above.

Is there a better/quicker way, is what I'm doing above accurate?

sherlock's picture

916 * 24 / 1000, I do it this way in the FluskoViz and now very proud of that as this method is not accurate due to the fact you are multiplying a rounding error 24 times.

To be more accurate you can get some smaller interval and calculate average power more acurately.

But there is not way to obtain power as a float from the API Server.

Maciej

icarus75's picture

Hi Torey,

Just call the api with a unit of kwhperyear with a day resolution, e.g.

  1. https://api.flukso.net/sensor/xyz?version=1.0&unit=kwhperyear&interval=month&resolution=day

Then convert to kWhperday by dividing each entry by 365. The number of significant digits will be more than sufficient. No need for IEEE 754 double-precision floats in the API.

Cheers,
-Bart.

toreym's picture

Thanks Bart. I like that method much better!

bazzle's picture

Or maybe go to pvoutput.org and the graphs and charts there do it for you :)

Bazzle