Plugin file
Plugin configuration file
{
"name": "moko_lw001_bgpro",
"version": "1.0.0",
"description": "Ultra-low power consumption, indoor&outdoor(BLE&WIFI&GPS) LoRaWAN Tracker",
"author": "Thinger.io",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/thinger-io/plugins.git",
"directory": "moko-lw001-bgpro"
},
"metadata": {
"name": "Moko LW001-BGPRO",
"description": "Ultra-low power consumption, indoor&outdoor(BLE&WIFI&GPS) LoRaWAN Tracker",
"image": "assets/lw001-bgpro-1.png",
"category": "devices",
"vendor": "moko"
},
"resources": {
"products": [
{
"description": "Ultra-low power consumption, indoor&outdoor(BLE&WIFI&GPS) LoRaWAN Tracker",
"enabled": true,
"name": "Moko LW001-BGPRO",
"product": "moko_lw001_bgpro",
"profile": {
"api": {
"downlink": {
"enabled": true,
"handle_connectivity": false,
"request": {
"data": {
"path": "/downlink",
"payload": "{\n \"data\" : \"{{payload.data=\"\"}}\",\n \"port\" : {{payload.port=85}},\n \"priority\": {{payload.priority=3}},\n \"confirmed\" : {{payload.confirmed=false}},\n \"uplink\" : {{property.uplink}} \n}",
"payload_function": "",
"payload_type": "",
"plugin": "{{property.uplink.source}}",
"target": "plugin_endpoint"
}
}
},
"uplink": {
"device_id_resolver": "getId",
"enabled": true,
"handle_connectivity": true,
"request": {
"data": {
"payload": "{{payload}}",
"payload_function": "",
"payload_type": "source_payload",
"resource_stream": "uplink",
"target": "resource_stream"
}
}
}
},
"autoprovisions": {
"device_autoprovisioning": {
"config": {
"mode": "pattern",
"pattern": "moko-lw001-bgpro-.*"
},
"enabled": true
}
},
"buckets": {
"moko_lw001_bgpro_data": {
"backend": "mongodb",
"data": {
"payload": "{{payload}}",
"payload_function": "decodeThingerUplink",
"payload_type": "source_payload",
"resource": "uplink",
"source": "resource",
"update": "events"
},
"enabled": true,
"retention": {
"period": 3,
"unit": "months"
},
"tags": []
}
},
"code": {
"code": "function decodeThingerUplink(thingerData) {\n // 0. If data has already been decoded, we will return it\n if (thingerData.decodedPayload) return thingerData.decodedPayload;\n \n // 1. Extract and Validate Input\n // We need 'payload' (hex string) and 'fPort' (integer)\n const hexPayload = thingerData.payload || \"\";\n const port = thingerData.fPort || 1;\n\n // 2. Convert Hex String to Byte Array\n const bytes = [];\n for (let i = 0; i < hexPayload.length; i += 2) {\n bytes.push(parseInt(hexPayload.substr(i, 2), 16));\n }\n\n // 3. Dynamic Function Detection and Execution\n \n // CASE A: (The Things Stack v3)\n if (typeof decodeUplink === 'function') {\n try {\n const input = {\n bytes: bytes,\n fPort: port\n };\n var result = decodeUplink(input);\n \n if (result.data) return result.data;\n\n return result; \n } catch (e) {\n console.error(\"Error inside decodeUplink:\", e);\n throw e;\n }\n }\n\n // CASE B: Legacy TTN (v2)\n else if (typeof Decoder === 'function') {\n try {\n return Decoder(bytes, port);\n } catch (e) {\n console.error(\"Error inside Decoder:\", e);\n throw e;\n }\n }\n\n // CASE C: No decoder found\n else {\n throw new Error(\"No compatible TTN decoder function (decodeUplink or Decoder) found in scope.\");\n }\n}\n\n\n// TTN decoder\nvar packet_type = [\"heart\",\"fix_success\",\"fix_false\",\"sys_close_info\",\"shake_info\",\"idle_info\",\"demolish_alarm\",\"event\",\"battery_consume\",\"config\",\"store_data\",\"limit_gps_data\"];\nvar dev_mode = [\"standby mode\",\"period mode\",\"timing mode\",\"motion mode\"];\nvar dev_fix_type = [\"work_mode_fix\",\"down_request_fix\"];\nfunction substringBytes(bytes, start, len)\n{\n\tvar char = [];\n\tfor(var i = 0; i < len; i++)\n\t{\n\t\tchar.push(\"0x\"+ bytes[start+i].toString(16) < 0X10 ? (\"0\"+bytes[start+i].toString(16)) : bytes[start+i].toString(16) );\n\t}\n\treturn char.join(\"\");\n}\nfunction BytestoInt(bytes,start) {\n var value = ((bytes[start] << 24) | (bytes[start+1] << 16) | (bytes[start+2] << 8) | (bytes[start+3]));\n return value;\n}\nfunction Decoder(bytes, port)\n{\n\tvar dev_info = {};\n\tdev_info.pack_type = packet_type[port-1];\n\t//common frame head\n\tif(port<=10)\n\t{\n\t\tdev_info.work_mode = dev_mode[bytes[0]&0x03];\n\t\tdev_info.low_power_state = (bytes[0]>>2)&0x01;\n\t\tdev_info.demolish_state = (bytes[0]>>3)&0x01;\n\t\tdev_info.idle_state = (bytes[0]>>4)&0x01;\n\t\tdev_info.motion_state = (bytes[0]>>5)&0x01;\n\t\tif(port==2 || port ==3)\n\t\t{\n\t\t\tdev_info.fix_type = dev_fix_type[(bytes[0]>>6)&0x01];\n\t\t}\n\t\t\n\t\tif(bytes[1]>0x80)\n\t\t{\n\t\t\tdev_info.ic_temperature = bytes[1] - 0x100 + \"°C\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdev_info.ic_temperature = bytes[1] + \"°C\";\n\t\t}\n\n\t\tdev_info.lorawan_downlink_count = bytes[2]&0x0f;\n\t\tdev_info.battery_voltage = (22+((bytes[2]>>4)&0x0f))/10;\n\t}\n\tif(port == 1)\n\t{\n\t\tvar restart_reason = [\"power_restart\",\"ble_cmd_restart\",\"lorawan_cmd_restart\",\"switch_off_mode_restart\"];\n\t\tdev_info.last_restart_reason = restart_reason[bytes[3]];\n\n\t\t\n\t\tver_major = (bytes[4]>>6)&0x03;\n\t\tver_mijor = (bytes[4]>>4)&0x03;\n\t\tver_patch = bytes[4]&0x0f;\n\t\tdev_info.firmware_ver = \"V\" + ver_major+\".\"+ver_mijor+\".\"+ver_patch;\n\n\t\tdev_info.motion_count = BytestoInt(bytes,5);\n\t}\n\telse if(port == 2)\n\t{\n\t\tvar fix_tech = [\"wifi\",\"ble\",\"gps\"];\n\t\tvar parse_len = 3; // common head is 3 byte\n\t\tvar datas = [];\n\t\ttech = bytes[parse_len++];\n\t\tdev_info.fix_tech = fix_tech[tech];\n\n\t\tyear = bytes[parse_len]*256 + bytes[parse_len+1];\n\t\tparse_len += 2;\n\t\tmon = bytes[parse_len++];\n\t\tdays = bytes[parse_len++];\n\t\thour = bytes[parse_len++];\n\t\tminute = bytes[parse_len++];\n\t\tsec = bytes[parse_len++];\n\t\ttimezone = bytes[parse_len++];\n\n\t\tif(timezone>0x80)\n\t\t{\n\t\t\tdev_info.utc_time = year + \"-\" + mon + \"-\" + days + \" \" + hour + \":\" + minute + \":\" + sec + \" TZ:\" + (timezone-0x100);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdev_info.utc_time = year + \"-\" + mon + \"-\" + days + \" \" + hour + \":\" + minute + \":\" + sec + \" TZ:\" + timezone;\n\t\t}\n\t\tdatalen = bytes[parse_len++];\n\n\t\tif(tech==0 || tech ==1)\n\t\t{\n\t\t\tfor(var i=0 ; i<(datalen/7) ; i++)\n\t\t\t{\n\t\t\t var data = {};\n\t\t\t\tdata.mac = substringBytes(bytes, parse_len, 6);\n\t\t\t\tparse_len += 6;\n\t\t\t\tdata.rssi = bytes[parse_len++]-256 +\"dBm\";\n\t\t\t\tdatas.push(data);\n\t\t\t}\n\t\t\tdev_info.mac_data = datas;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlat =BytestoInt(bytes,parse_len);\n\t\t\tparse_len += 4;\n\t\t\tlon =BytestoInt(bytes,parse_len);\n\t\t\tparse_len += 4;\n\n\t\t\tif(lat>0x80000000)\n\t\t\t\tlat = lat-0x100000000;\n\t\t\tif(lon>0x80000000)\n\t\t\t\tlon = lon-0x100000000;\n\n\t\t\tdev_info.lat = lat/10000000;\n\t\t\tdev_info.lon = lon/10000000;\n\t\t\tdev_info.pdop = bytes[parse_len] /10;\n\t\t}\n\t}\n\telse if(port == 3)\n\t{\n\n\t\tvar fix_false_reason = [\"wifi_fix_time_timeout\",\"wifi_fix_tech_timeout\",\"wifi_module_nofind\",\"ble_fix_time_timeout\",\"ble_fix_tech_timeout\",\"ble_adv\",\"gps_no_budget\",\"gps_coarse_acc_timeout\",\"gps_fine_acc_timeout\",\"gps_fix_timeout\",\"gps_assistnow_timeout\",\"gps_cold_start_timeout\",\"down_request_fix_interrupt\",\"motion_start_fix_false_by_motion_end\",\"motion_end_fix_false_by_motion_start\"];\n\t\tvar parse_len = 3; \n\t\tvar datas = [];\n\t\treason = bytes[parse_len++];\n\t\tdev_info.fix_false_reason = fix_false_reason[reason];\n\t\tdatalen = bytes[parse_len++];\n\t\tif(reason<=5) //wifi and ble reason\n\t\t{\n\t\t if(datalen)\n\t\t {\n \t\t\tfor(var i=0 ; i<(datalen/7) ; i++)\n \t\t\t{\n \t\t\t var data = {};\n \t\t\t\tdata.mac = substringBytes(bytes, parse_len, 6);\n \t\t\t\tparse_len += 6;\n \t\t\t\tdata.rssi = bytes[parse_len++]-256 +\"dBm\";\n \t\t\t\tdatas.push(data);\n \t\t\t}\n \t\t\tdev_info.mac_data = datas;\n\t\t }\n\t\t}\n\t\telse if(reason<=11) //gps reason\n\t\t{\t\n\t\t\tpdop = bytes[parse_len++];\n\t\t\tif(pdop!=0xff)\n\t\t\t\tdev_info.pdop = pdop/10\n\t\t\telse\n\t\t\t\tdev_info.pdop = \"unknow\";\n\t\t\tdev_info.gps_satellite_cn = bytes[parse_len] +\"-\" + bytes[parse_len+1] +\"-\" + bytes[parse_len+2] +\"-\" + bytes[parse_len+3] ;\n\t\t}\n\t}\n\telse if(port == 4)\n\t{\n\t\tvar sys_close_reason = [\"ble_cmd_close\",\"lorawan_cmd_close\",\"reed_switch_close\"];\n\t\tdev_info.sys_close_reason = sys_close_reason[bytes[3]];\n\t}\n\telse if(port == 5)\n\t{\n\t\tdev_info.shake_num = bytes[3]*256+ bytes[4];\n\t}\n\telse if(port == 6)\n\t{\n\t\tdev_info.idle_time = bytes[3]*256+ bytes[4];\n\t}\n\telse if(port == 7)\n\t{\n\t\tvar parse_len = 3; // common head is 3 byte\n\t\tyear = bytes[parse_len]*256 + bytes[parse_len+1];\n\t\tparse_len += 2;\n\t\tmon = bytes[parse_len++];\n\t\tdays = bytes[parse_len++];\n\t\thour = bytes[parse_len++];\n\t\tminute = bytes[parse_len++];\n\t\tsec = bytes[parse_len++];\n\t\ttimezone = bytes[parse_len++];\n\n\t\tif(timezone>0x80)\n\t\t{\n\t\t\tdev_info.alarm_time = year + \"-\" + mon + \"-\" + days + \" \" + hour + \":\" + minute + \":\" + sec + \" TZ:\" + (timezone-0x100);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdev_info.alarm_time = year + \"-\" + mon + \"-\" + days + \" \" + hour + \":\" + minute + \":\" + sec + \" TZ:\" + timezone;\n\t\t}\n\t}\n\telse if(port == 8)\n\t{\n\t\tvar event = [\"motion start\",\"moving fix start\",\"motion end\",\"lorawan downlink trigger uplink\"];\n\t\tdev_info.event_info = event[bytes[3]];\n\t}\n\telse if(port == 9)\n\t{\n\t\tvar parse_len = 3;\n\t\tdev_info.gps_work_time = BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\t\tdev_info.wifi_work_time = BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\t\tdev_info.ble_scan_work_time = BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\t\tdev_info.ble_adv_work_time = BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\t\tdev_info.lorawan_work_time = BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\t}\n\telse if(port == 10)\n\t{\n\t\t//\n\t}\n\telse if(port == 11)\n\t{\n\t\t//\n\t}\n\telse if(port == 12)\n\t{\n\n\t\tdev_info.work_mode = dev_mode[bytes[0]&0x03];\n\t\tdev_info.low_power_state = bytes[0]&0x04;\n\t\tdev_info.demolish_state = bytes[0]&0x08;\n\t\tdev_info.idle_state = bytes[0]&0x10;\n\t\tdev_info.motion_state = bytes[0]&0x20;\n\t\tdev_info.fix_type = dev_fix_type[(bytes[0]>>6)&0x01];\n\n\t\tdev_info.lorawan_downlink_count = bytes[1]&0x0f;\n\t\tdev_info.battery_voltage = (22+((bytes[2]>>4)&0x0f))/10;\n\n\t\tvar parse_len = 2;\n\t\tlat =BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\t\tlon =BytestoInt(bytes,parse_len);\n\t\tparse_len += 4;\n\n\t\tif(lat>0x80000000)\n\t\t\tlat = lat-0x100000000;\n\t\tif(lon>0x80000000)\n\t\t\tlon = lon-0x100000000;\n\n\t\tdev_info.lat = lat/10000000 ;\n\t\tdev_info.lon = lon/10000000;\n\t\tdev_info.pdop = bytes[parse_len]/10;\n\t}\n\treturn dev_info;\n} \n\nfunction decodeUplink(input) {\n\treturn {\n\t data : Decoder(input.bytes, input.fPort),\n\t};\n}\n\nfunction normalizeUplink(input) {\n\tvar data = {};\n\tvar action = {};\n\tvar position = {};\n\tvar motion = {};\n\n\tif (input.data.motion_state) {\n\t\tmotion.detected = input.data.motion_state > 0;\n motion.count = input.data.motion_count;\n action.motion = motion;\n\t}\n\n\tif (input.data.lat) {\n\t\tposition.latitude = input.data.lat;\n\t}\n\n\tif (input.data.lon) {\n\t\tposition.longitude = input.data.lon;\n\t}\n\n\tif (Object.keys(action).length > 0) {\n\t\tdata.action = action;\n\t}\n\n\tif (Object.keys(position).length > 0) {\n\t\tdata.position = position;\n\t}\n\n\tif (input.data.battery_voltage) {\n\t\tdata.battery = input.data.battery_voltage;\n\t}\n\n\treturn { data: data };\n}\n",
"environment": "javascript",
"storage": "",
"version": "1.0"
},
"properties": {
"uplink": {
"data": {
"payload": "{{payload}}",
"payload_function": "",
"payload_type": "source_payload",
"resource": "uplink",
"source": "resource",
"update": "events"
},
"default": {
"source": "value"
},
"enabled": true
}
}
},
"_resources": {
"properties": [
{
"property": "dashboard",
"value": {
"tabs": [
{
"name": "Tracker",
"widgets": [
{
"layout": {
"col": 0,
"row": 0,
"sizeX": 4,
"sizeY": 12
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Device Location"
},
"properties": {
"center": true,
"clusterMarkers": false,
"mapType": "roadmap",
"zoom": 12
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "lat",
"tags": {
"device": [],
"group": []
}
},
"color": "#1abc9c",
"name": "lat",
"source": "bucket",
"timespan": {
"mode": "latest"
}
},
{
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "lon",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "lon",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "map"
},
{
"layout": {
"col": 4,
"row": 0,
"sizeX": 1,
"sizeY": 6
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Battery Voltage"
},
"properties": {
"color": "#f0e924",
"max": 3.6,
"min": 2.2,
"unit": "V"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "battery_voltage",
"tags": {
"device": [],
"group": []
}
},
"color": "#f0e924",
"name": "Battery",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "donutchart"
},
{
"layout": {
"col": 4,
"row": 6,
"sizeX": 1,
"sizeY": 6
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "IC Temperature"
},
"properties": {
"color": "#e74c3c",
"max": 85,
"min": -40,
"unit": "°C"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "ic_temperature",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "Temperature",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "donutchart"
},
{
"layout": {
"col": 5,
"row": 0,
"sizeX": 1,
"sizeY": 6
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Motion State"
},
"properties": {
"source": "code",
"template": "<div style=\"width:100%; height:100%; display:flex; flex-direction:column; justify-content:center; align-items:center; font-size:24px;\">\n <div ng-if=\"value[0] !== undefined\">\n <i class=\"fa\" ng-class=\"value[0] > 0 ? 'fa-running' : 'fa-bed'\" style=\"font-size:48px; margin-bottom:10px;\" ng-style=\"{color: value[0] > 0 ? '#e74c3c' : '#95a5a6'}\"></i>\n <div>{{ value[0] > 0 ? 'Motion Detected' : 'Stationary' }}</div>\n </div>\n <div ng-if=\"value[0] === undefined\">No Data</div>\n</div>"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "motion_state",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Motion",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "html"
},
{
"layout": {
"col": 5,
"row": 6,
"sizeX": 1,
"sizeY": 6
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Fix Type"
},
"properties": {
"source": "code",
"template": "<div style=\"width:100%; height:100%; display:flex; flex-direction:column; justify-content:center; align-items:center; font-size:18px; text-align:center;\">\n <div ng-if=\"value[0]\">\n <i class=\"fa fa-map-marker\" style=\"font-size:36px; margin-bottom:10px; color:#3498db;\"></i>\n <div>{{ value[0] }}</div>\n </div>\n <div ng-if=\"!value[0]\">No Fix Data</div>\n</div>"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "fix_tech",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Fix Tech",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "html"
},
{
"layout": {
"col": 0,
"row": 12,
"sizeX": 6,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Location History"
},
"properties": {
"source": "code",
"template": "<div style=\"width:100%; height:100%; overflow-y:auto\">\n <table class=\"table table-striped table-condensed\">\n <thead>\n <tr>\n <th>Date</th>\n <th>Latitude</th>\n <th>Longitude</th>\n <th>Fix Type</th>\n <th>PDOP</th>\n <th>Battery (V)</th>\n <th>Motion</th>\n </tr>\n </thead>\n <tbody>\n <tr ng-repeat=\"entry in value\">\n <td>{{ entry.ts | date:'medium' }}</td>\n <td>{{ entry.lat ? entry.lat.toFixed(6) : '—' }}</td>\n <td>{{ entry.lon ? entry.lon.toFixed(6) : '—' }}</td>\n <td>{{ entry.fix_tech || '—' }}</td>\n <td>{{ entry.pdop || '—' }}</td>\n <td>{{ entry.battery_voltage || '—' }}</td>\n <td>\n <span ng-if=\"entry.motion_state > 0\" style=\"color:#e74c3c;\">●</span>\n <span ng-if=\"entry.motion_state === 0\" style=\"color:#95a5a6;\">○</span>\n </td>\n </tr>\n </tbody>\n </table>\n</div>"
},
"sources": [
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "ts",
"tags": {
"device": [],
"group": []
}
},
"color": "#1abc9c",
"name": "timestamp",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
},
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "lat",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "latitude",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
},
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "lon",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "longitude",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
},
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "fix_tech",
"tags": {
"device": [],
"group": []
}
},
"color": "#9b59b6",
"name": "fix_tech",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
},
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "pdop",
"tags": {
"device": [],
"group": []
}
},
"color": "#f39c12",
"name": "pdop",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
},
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "battery_voltage",
"tags": {
"device": [],
"group": []
}
},
"color": "#f0e924",
"name": "battery",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
},
{
"aggregation": {},
"bucket": {
"backend": "mongodb",
"id": "moko_lw001_bgpro_data",
"mapping": "motion_state",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "motion",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"value": 24
}
}
],
"type": "html_time"
}
]
}
]
}
}
]
}
}
]
}
}