This macro converts and displays a stream of environmental sensors data sets obtained using the _protocol_set_ feature.
// Define the output object here
var output = {};
// Check if the key time exists in json
if (json.time !== undefined){
output.data=json.data_raw;
output.data_F0=json.data_raw[0];
output.data_FM=json.data_raw[99];
output.FVFM=MathROUND((1-(output.data_F0/output.data_FM)),3);
output.data=json.data_raw;
output.light_intensity=json.light_intensity;
}
return output;
{
"time": "1499431603008",
"device_name": "MultispeQ",
"device_version": "1",
"device_id": "01:12:38:34",
"device_battery": 26,
"device_firmware": 1.2,
"sample": [
[
{
"time": "1499431603019",
"protocol_id": 1,
"detector_read1": 13927,
"light_intensity": 16.208,
"r": 10,
"g": 5,
"b": 3,
"light_intensity_raw": 17,
"temperature": 25.82,
"humidity": 44.963,
"pressure": 1011.373,
"temperature2": 25.93,
"humidity2": 45.269,
"pressure2": 1011.09,
"contactless_temp": 24.61,
"thickness": 0.09,
"compass_direction": "E",
"compass": 90,
"angle": 2.326,
"angle_direction": "S",
"pitch": 2.33,
"roll": 0,
"data_raw": [
2213,
2228,
2242,
2253,
2267,
2280,
2295,
2308,
2319,
2329,
2341,
2353,
2364,
2374,
2380,
2391,
2407,
2410,
2419,
2426,
2432,
2439,
2445,
2451,
2457,
2463,
2467,
2471,
2475,
2479,
2480,
2485,
2490,
2495,
2496,
2502,
2504,
2508,
2511,
2514,
2518,
2522,
2526,
2530,
2534,
2535,
2540,
2539,
2541,
2543,
7759,
9190,
9663,
9864,
9983,
10070,
10127,
10191,
10247,
10303,
10343,
10392,
10431,
10462,
10501,
10534,
10567,
10592,
10613,
10630,
10651,
10665,
10680,
10695,
10692,
10703,
10717,
10722,
10725,
10721,
10723,
10729,
10733,
10732,
10725,
10727,
10730,
10728,
10727,
10727,
10719,
10723,
10721,
10719,
10720,
10709,
10706,
10712,
10703,
10706,
9539,
8882,
8463,
8165,
7929,
7746,
7585,
7448,
7333,
7229,
7138,
7056,
6986,
6921,
6859,
6808,
6761,
6715,
6673,
6631,
6593,
6558,
6526,
6492,
6461,
6431,
6410,
6381,
6357,
6331,
6310,
6287,
6263,
6244,
6217,
6202,
6182,
6162,
6143,
6123,
6110,
6092,
6074,
6055,
6043,
6024,
6011,
5999,
5987,
5972,
5964,
5953,
5939,
5928,
5923,
5911,
5902,
5892,
5886,
5879,
5867,
5861,
5853,
5845,
5838,
5830,
5823,
5815,
5810,
5803,
5798,
5791,
5785,
5779,
5769,
5765,
5759,
5755,
5747,
5741,
5737,
5733,
5729,
5721,
5716,
5710,
5707,
5703,
5693,
5692,
5686,
5681,
5676,
5671,
5668,
5662,
5658,
5647,
5645,
5636
]
}
]
],
"app_os": "darwin-15.6.0",
"app_name": "PhotosynQ",
"app_version": "0.0.15",
"app_device": "x64",
"location": false,
"time_offset": "Europe/Amsterdam"
}