Query API: only works with current log - not so, explained


First, i have searched for similar issues/questions in this community, but i couldnt find anything.

Why is it that i get 0 results from querying dates which are in the history log. I dont get any errors, just that there are no values.

Current Log from: 31-1-2020 06:06:55 to: 31-1-2021 14:26:10
History Log from: 24-12-2019 17:34:00 to: 31-1-2021 14:26:00


curl --globoff "[time.local.iso,NET.volts.d2,NET.hz.d2,WTW.watts.d2,WTW.amps.d2,WTW.wh.d2,WTW.va.d2,WTW.var.d2,WTW.varh.d2,WTW.pf.d2]&begin=2020-01-31T06:00:00&end=2020-01-31T06:10:00&group=5s&format=csv&missing=zero" && echo ""


2020-01-31T06:00:00, 0, 0, 0, 0, 0, 0, 0, 0, 0

command 2:

curl --globoff "[time.local.iso,NET.volts.d2,NET.hz.d2,WTW.watts.d2,WTW.amps.d2,WTW.wh.d2,WTW.va.d2,WTW.var.d2,WTW.varh.d2,WTW.pf.d2]&begin=2020-01-31T06:10:00&end=2020-01-31T06:20:00&group=5s&format=csv&missing=zero" && echo ""


2020-01-31T06:10:00, 234.97, 49.96, 53.72, 0.42, 0.07, 99.69, 83.97, 0.12, 0.54
2020-01-31T06:10:05, 235.24, 49.97, 53.57, 0.42, 0.07, 99.22, 83.52, 0.12, 0.54
2020-01-31T06:10:10, 235.28, 49.97, 53.52, 0.42, 0.07, 99.3, 83.65, 0.12, 0.54

Is there a way to query the history log using the API?

You’ve opened up a few issues here. I’ll start by saying that your result should be different, but not in the way you expect.

The history log has resolution of 1 minute and you are asking for 5 second grouping. That presents a dilemma as to the appropriate response. Some possibilities are:

  1. Reject the query as not possible.
  2. Adjust the grouping 1m.
  3. Respond with only current log data.
  4. Respond with 5 second timestamps but only one in 12 for history log data.
  5. For Watts, Amps etc respond with the 1m value for all 12 groups from history log and 1/12 for Wh.

It does seem to work as expected with history log data when the grouping is a multiple of 1m.

I’ll revisit the failure mode after giving any others a reasonable time to comment on this thread.

Hi overeasy,

Thank you for your quick response. Im somewhat annoyed by your answer. I’ll tell you what im trying to do and what im not able to because of the choices made.

Im trying to make a graph using the amount of datapoints i choose. The smallest group is 5s and the largest Yearly. When using groups with a growing length of time, the Graphs give a complete different view compared to when using a smaller group. I understand why the Iotawatt (Graph+) is unable to create graphs with thousands of datapoints.

So i build a bash-script fetching all 5s data from the iotawatt, until i ran into the issue where i just posted about. The size of all the data i extracted is: 1255MB in csv files. With another script i would be able to combine everything back together. The fact that there is no way to fully extract all my data without being limited by groups or whatsoever annoys me. I dont have any C++ skills, but i would love a simple tool which converts the binary data to a csv-file. Currently i cannot use the iotawatt the way i want to.


What I’m saying is that you don’t have 5 second data before Jan 31, 2020 and that continues to disappear as the current log rolls forward. You have one minute data and you can fully extract that.

If you wanted to retain 5 second data perpetually, the way to have done that would have been to upload it to an external database. IoTaWatt fully supports that. It’s not a general purpose computer that can save and serve up gigabytes of data forever.