Coffee + Kombucha


goes with protocol of same name
//============================================
// Macro for data evaluation on PhotosynQ.org
// created: 15/10/2016
//============================================

//Define the output object here
var output = {};

var trans_red = MathMEDIAN(json.data_raw.slice(40,90));
var trans_orange = MathMEDIAN(json.data_raw.slice(140,190));
var trans_ir = MathMEDIAN(json.data_raw.slice(240,290));

var blank_red = json.recall["userdef[1]"];
var blank_orange = json.recall["userdef[2]"];
var blank_ir = json.recall["userdef[3]"];

output["transmission_red"] = MathROUND(trans_red/(blank_red));
output["transmission_orange"] = MathROUND(trans_orange/(blank_orange));
output["transmission_ir"] = MathROUND(trans_ir/(blank_ir));

output["trans_red"] = trans_red;
output["trans_orange"] = trans_orange;
output["trans_ir"] = trans_ir;

//Check if the key time exists in json
if (json.time !== undefined){

	//Add key time and value to output
	output["time"] = json.time;
}

//Return data
return output;
{
  "time_offset": 240,
  "time": 1476544705944,
  "device_version": "1",
  "device_id": "d4:f5:00:00:00:14",
  "device_battery": 63,
  "device_firmware": "1.10",
  "firmware_version": "1.10",
  "device_time": 1476366555,
  "sample": [
    [
      {
        "time": 1476544705961,
        "protocol_id": 1,
        "recall": {
          "time": 1476544706556,
          "userdef[1]": 43613.5,
          "userdef[2]": 25071,
          "userdef[3]": 16661
        },
        "data_raw": [
          65535,
          65535,
          65535,
          65535,
          62695,
          54705,
          48537,
          43652,
          39636,
          36296,
          33475,
          31057,
          28940,
          27075,
          25414,
          23929,
          22594,
          21362,
          20250,
          19234,
          18300,
          18104,
          18079,
          18055,
          18043,
          18023,
          18007,
          17997,
          17998,
          17991,
          17987,
          17981,
          17976,
          17977,
          17966,
          17964,
          17966,
          17966,
          17965,
          17962,
          17959,
          17961,
          17955,
          17954,
          17951,
          17955,
          17955,
          17952,
          17954,
          17951,
          17953,
          17945,
          17947,
          17947,
          17950,
          17947,
          17949,
          17945,
          17947,
          17943,
          17943,
          17942,
          17945,
          17948,
          17950,
          17949,
          17947,
          17946,
          17943,
          17942,
          17939,
          17940,
          17945,
          17945,
          17946,
          17944,
          17945,
          17941,
          17937,
          17935,
          17940,
          17941,
          17941,
          17941,
          17939,
          17942,
          17941,
          17935,
          17934,
          17934,
          17937,
          17934,
          17935,
          17937,
          17937,
          17939,
          17933,
          17933,
          17934,
          17939,
          16679,
          16721,
          16723,
          16721,
          16723,
          16721,
          16715,
          16718,
          16720,
          16725,
          16723,
          16719,
          16721,
          16722,
          16726,
          16721,
          16718,
          16717,
          16716,
          16723,
          16725,
          16724,
          16725,
          16724,
          16724,
          16726,
          16720,
          16719,
          16722,
          16724,
          16721,
          16724,
          16727,
          16724,
          16724,
          16723,
          16719,
          16716,
          16717,
          16719,
          16723,
          16721,
          16723,
          16719,
          16722,
          16724,
          16717,
          16718,
          16717,
          16719,
          16721,
          16721,
          16719,
          16723,
          16723,
          16723,
          16723,
          16717,
          16715,
          16711,
          16721,
          16725,
          16721,
          16719,
          16718,
          16717,
          16721,
          16721,
          16716,
          16719,
          16714,
          16719,
          16719,
          16719,
          16720,
          16723,
          16721,
          16722,
          16718,
          16717,
          16717,
          16719,
          16721,
          16718,
          16723,
          16723,
          16723,
          16719,
          16718,
          16720,
          16719,
          16719,
          16714,
          16718,
          16718,
          16721,
          16719,
          16725,
          16722,
          16719,
          19175,
          18964,
          18939,
          18934,
          18936,
          18940,
          18935,
          18933,
          18935,
          18933,
          18935,
          18938,
          18938,
          18926,
          18926,
          18927,
          18921,
          18934,
          18931,
          18927,
          18931,
          18933,
          18927,
          18928,
          18931,
          18926,
          18924,
          18923,
          18930,
          18927,
          18933,
          18933,
          18931,
          18931,
          18924,
          18925,
          18927,
          18929,
          18923,
          18919,
          18919,
          18926,
          18931,
          18923,
          18930,
          18927,
          18932,
          18927,
          18927,
          18930,
          18927,
          18928,
          18922,
          18929,
          18926,
          18930,
          18929,
          18929,
          18923,
          18927,
          18927,
          18933,
          18931,
          18927,
          18927,
          18923,
          18924,
          18931,
          18923,
          18933,
          18926,
          18931,
          18929,
          18930,
          18930,
          18930,
          18925,
          18919,
          18921,
          18919,
          18921,
          18927,
          18924,
          18927,
          18929,
          18929,
          18931,
          18925,
          18925,
          18927,
          18924,
          18928,
          18919,
          18919,
          18926,
          18928,
          18930,
          18925,
          18927,
          18927
        ]
      }
    ]
  ],
  "app_os": "linux",
  "app_name": "PhotosynQ",
  "app_version": "0.3.5",
  "app_device": "x86-64",
  "location": [
    "42.7230599",
    "-84.4743947"
  ],
  "ConsoleMacro": "239"
}
012409 pbi 160 low low res headshot
Created by

Greg Austic


Protocol connections:
1
Latest Update:
Oct 2016