[Improvement] Add info on timespan and number ob objects to stats-api
See original GitHub issueHi,
I am just trying to connect an esp8266 to mycontroller to get the latest data of the current day:
http://raspi:8443/mc/rest/metrics/stats?sensorId=234×tampFrom=1486141273860
This is working so far … I even found a nice json streaming library: https://github.com/squix78/json-streaming-parser
For an microcontroller with constrained memory etc. it would be really nice to know how many items are in the response and what timespan is covered. The current response is like this:
[ {
"id" : 263,
"internalId" : 234,
"variableType" : "Humidity",
"unit" : "%",
"dataType" : "Double",
"timeFormat" : "HH:mm:ss",
"resourceName" : "[G]:mygateway >> [N]:31:MultiSensor >> [S]:0:Humidity >> [SV]:Humidity",
"chartType" : "lineChart",
"chartInterpolate" : "linear",
"chartData" : [ {
"key" : "Average",
"values" : [ [ 1486144083769, 45.52727272727273 ], [ 1486144143769
I suggest adding from-timestamp, to-timestamp and number of items
[ { “id” : 263, “internalId” : 234, “variableType” : “Humidity”, “unit” : “%”, “dataType” : “Double”, “timeFormat” : “HH:mm:ss”, “resourceName” : “[G]:mygateway >> [N]:31:MultiSensor >> [S]:0:Humidity >> [SV]:Humidity”, “chartType” : “lineChart”, “chartInterpolate” : “linear”, “chartFromTS” : “1486144083769”, “chartToTS” : “1486230303769”, “chartDataItems” : 12345, “chartData” : [ { “key” : “Average”, “values” : [ [ 1486144083769, 45.52727272727273 ], [ 1486144143769
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (4 by maintainers)
@jkandasa: I am pretty happy with your latest implementation of duration. There is an pretty nice json-library which I use to parse the json returned by your api.
Just a sneak-preview of what I want to use it for:
Notice the little graph at the bottom, data fresh pulled from mycontroller … last 12hours in 30minute steps … it is pretty rough for now … no x-axis … but this will be my work for next weekend.
PS: Did you already add documentation for the “new” api? I think it is awesome and might help other fellow hackers out there a lot 😉
Oh yes! Thanks for the details. I’m planning a similar project using a MoteinoMega (https://lowpowerlab.com/shop/product/138) I’m hoping that 128kbyte + 512kbyte flash is enough to hold all graphics.