Hi.
Is there a place where the format of the data string that is sent to emoncms is documented ?
I mean the string that is added to the URL, like this :
Sending remote data
GET /emoncms/input/bulk.json?apikey=xxxxxxxxxxxxxx&data=[[0,10,1806],[0,10,1806],[4,10,1806],[7,10,1806],[11,10,1806],[15,10,1800],[19,10,1800],[23,10,1800],[26,10,1806],[30,10,1806],[34,10,1800]] HTTP/1.1
This is what I got in the raspberrypi module. I just added an echo $com in getcontent().
My particular concern for today is the following :
I don't know why I got twice the [0,10,1806] but anyway, as I understand it, the first value of each [0,10,1806] sub-array is the time since last time $start_time was reset. In practice, it should be reset about every 30 seconds (apparently, in this case, it took a bit more).
I understand this time information is needed by target remote emoncms to associate each value with the right time in the past, as all those values are sent at once. What I don't understand is how remote emoncms knows what 0 accounts for. Basically, 0 is when $start_time was reset, which is something like 35 s before now, but when exactly ?
I hope I'm making myself clear.
I've got the feeling we're losing information, here.
Could it be every sample ends up delayed about 30s, sometimes 35 or 40 and we don't care ?
I would understand something like data=[[-30,10,1806],[-25,10,1806],[-20,10,1806],[-15,10,1806]] to indicate the time difference with now. Or better, an absolute time value.
Is there something I misunderstood ?
By the way, is there a data string that can be sent to set a particular value (or set of values) at a given time ?
Thanks.
Re: Input API documentation ?
There is a little bit of info in the API help.
Including a line
http://domain.tld/emoncms/input/post?time=1360577239&node=1&csv=100,200,300
that suggests an absolute time could be set in the string.
There seems to be several ways of doing the same thing (csv/json, for instance), I'm a bit confused.
I'm wondering if the time=12345678 could address the concern I expressed in the question above.
A string like this
GET /emoncms/input/bulk.json?apikey=xxxxxxxxxxxxxx&time=123456789&data=[[0,10,1806],[0,10,1806],[4,10,1806],[7,10,1806],[11,10,1806],[15,10,1800],[19,10,1800],[23,10,1800],[26,10,1806],[30,10,1806],[34,10,1800]]
where time would be the absolute time when $start_time was reset, would allow emoncms to know at what time each sample was received from emonTX.
Is there a place I can get more comprehensive information about the API than this page in emoncms, apart from the code itself (I may get to understand it more widely some day, but the learning curve is steep) ? I'm afraid not.