Hi there,
I'm stuck on something:
I need to write data containing a measurement to an external database which require a specific JSON format which look like this:
{
"point": {
"UNIXTIME1": VALUE1,
"UNIXTIME2": VALUE2,
and so on
}
for example:
{
"point": {
"1514764800000": 128,
"1514768400000": 9.6,
"1514772000000": 20.3,
"1514775600000": 15.4,
"1514779200000": 17.6
}
}
So the key of the value is the current time which I can get with
var t = d.getTime(new Date());
Now how to create keys based on this time and assign to it a value which is contained in msg.payload into another key value "point" (which is static) ?
The first step is to generate the JSON object containing 1 value on each measurement. The second would be to generate the output JSON object every X measurement after X occurence.
English is not my main langugage, I hope you can understand
Sincerely
Max