Plugin file
Plugin configuration file
{
"name": "dragino_lsn50_v2",
"version": "1.0.0",
"description": "The Dragino LSN50-V2 is a LoRaWAN® end device that allows connecting various external sensors.",
"author": "Thinger.io",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/thinger-io/plugins.git",
"directory": "dragino-lsn50-v2"
},
"metadata": {
"name": "Dragino LSN50-V2",
"description": "The Dragino LSN50-V2 is a LoRaWAN® end device that allows connecting various external sensors.",
"image": "assets/lsn50-v2.png",
"category": "devices",
"vendor": "dragino"
},
"resources": {
"products": [
{
"description": "The Dragino LSN50-V2 is a LoRaWAN® end device that allows connecting various external sensors.",
"enabled": true,
"name": "Dragino LSN50-V2",
"product": "dragino_lsn50_v2",
"profile": {
"api": {
"downlink": {
"enabled": true,
"handle_connectivity": false,
"request": {
"data": {
"path": "/downlink",
"payload": "{\r\n \"data\" : \"{{payload.data=\"\"}}\",\r\n \"port\" : {{payload.port=2}},\r\n \"priority\": {{payload.priority=3}},\r\n \"confirmed\" : {{payload.confirmed=false}},\r\n \"uplink\" : {{property.uplink}} \r\n}",
"plugin": "{{property.uplink.source}}",
"target": "plugin_endpoint"
}
}
},
"uplink": {
"enabled": true,
"handle_connectivity": true,
"request": {
"data": {
"payload": "{{payload}}",
"payload_type": "source_payload",
"resource_stream": "uplink",
"target": "resource_stream"
}
}
}
},
"autoprovisions": {
"device_autoprovisioning": {
"config": {
"mode": "pattern",
"pattern": "lsn50_v2_.*"
},
"enabled": true
}
},
"buckets": {
"dragino_lsn50_v2_data": {
"backend": "mongodb",
"data": {
"payload": "{{payload}}",
"payload_type": "source_payload",
"resource": "uplink_decoded",
"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\nfunction decodeUplink(input) {\n var mode = (input.bytes[6] & 0x7c) >> 2;\n var data = {};\n switch (input.fPort) {\n case 2:\n if (mode != 2 && mode != 31) {\n var decode = {};\n\n decode.Digital_IStatus = input.bytes[6] & 0x02 ? 'H' : 'L';\n\n if (mode != 2) {\n decode.BatV = ((input.bytes[0] << 8) | input.bytes[1]) / 1000;\n if (input.bytes[2] == 0x7f && input.bytes[3] == 0xff) decode.TempC1 = 'NULL';\n else decode.TempC1 = parseFloat(((((input.bytes[2] << 24) >> 16) | input.bytes[3]) / 10).toFixed(1));\n if (mode != 8) decode.ADC_CH0V = ((input.bytes[4] << 8) | input.bytes[5]) / 1000;\n }\n\n if (mode != 5 && mode != 6) {\n decode.EXTI_Trigger = input.bytes[6] & 0x01 ? 'TRUE' : 'FALSE';\n decode.Door_status = input.bytes[6] & 0x80 ? 'CLOSE' : 'OPEN';\n }\n\n if (mode == '0') {\n decode.Work_mode = 'IIC';\n if (((input.bytes[9] << 8) | input.bytes[10]) === 0) decode.Illum = (input.bytes[7] << 8) | input.bytes[8];\n else {\n if ((input.bytes[7] == 0x7f && input.bytes[8] == 0xff) || (input.bytes[7] == 0xff && input.bytes[8] == 0xff)) decode.TempC_SHT = 'NULL';\n else decode.TempC_SHT = parseFloat(((((input.bytes[7] << 24) >> 16) | input.bytes[8]) / 10).toFixed(1));\n\n if (input.bytes[9] == 0xff && input.bytes[10] == 0xff) decode.Hum_SHT = 'NULL';\n else decode.Hum_SHT = parseFloat((((input.bytes[9] << 8) | input.bytes[10]) / 10).toFixed(1));\n }\n } else if (mode == '1') {\n decode.Work_mode = 'Distance';\n\n if (input.bytes[7] === 0x00 && input.bytes[8] === 0x00) decode.Distance_cm = 'NULL';\n else decode.Distance_cm = parseFloat((((input.bytes[7] << 8) | input.bytes[8]) / 10).toFixed(1));\n\n if (!(input.bytes[9] == 0xff && input.bytes[10] == 0xff)) decode.Distance_signal_strength = (input.bytes[9] << 8) | input.bytes[10];\n } else if (mode == '2') {\n decode.Work_mode = '3ADC+IIC';\n decode.BatV = input.bytes[11] / 10;\n decode.ADC_CH0V = ((input.bytes[0] << 8) | input.bytes[1]) / 1000;\n decode.ADC_CH1V = ((input.bytes[2] << 8) | input.bytes[3]) / 1000;\n decode.ADC_CH4V = ((input.bytes[4] << 8) | input.bytes[5]) / 1000;\n if (((input.bytes[9] << 8) | input.bytes[10]) === 0) decode.Illum = (input.bytes[7] << 8) | input.bytes[8];\n else {\n if ((input.bytes[7] == 0x7f && input.bytes[8] == 0xff) || (input.bytes[7] == 0xff && input.bytes[8] == 0xff)) decode.TempC_SHT = 'NULL';\n else decode.TempC_SHT = parseFloat(((((input.bytes[7] << 24) >> 16) | input.bytes[8]) / 10).toFixed(1));\n\n if (input.bytes[9] == 0xff && input.bytes[10] == 0xff) decode.Hum_SHT = 'NULL';\n else decode.Hum_SHT = parseFloat((((input.bytes[9] << 8) | input.bytes[10]) / 10).toFixed(1));\n }\n } else if (mode == '3') {\n decode.Work_mode = '3DS18B20';\n if (input.bytes[7] == 0x7f && input.bytes[8] == 0xff) decode.TempC2 = 'NULL';\n else decode.TempC2 = parseFloat(((((input.bytes[7] << 24) >> 16) | input.bytes[8]) / 10).toFixed(1));\n\n if (input.bytes[9] == 0x7f && input.bytes[10] == 0xff) decode.TempC3 = 'NULL';\n else decode.TempC3 = parseFloat(((((input.bytes[9] << 24) >> 16) | input.bytes[10]) / 10).toFixed(1));\n } else if (mode == '4') {\n decode.Work_mode = 'Weight';\n decode.Weight = (input.bytes[9] << 24) | (input.bytes[10] << 16) | (input.bytes[7] << 8) | input.bytes[8];\n } else if (mode == '5') {\n decode.Work_mode = '1Count';\n decode.Count = ((input.bytes[7] << 24) | (input.bytes[8] << 16) | (input.bytes[9] << 8) | input.bytes[10]) >>> 0;\n } else if (mode == '6') {\n decode.Work_mode = '3Interrupt';\n decode.EXTI1_Trigger = input.bytes[6] & 0x01 ? 'TRUE' : 'FALSE';\n decode.EXTI1_Status = input.bytes[6] & 0x80 ? 'CLOSE' : 'OPEN';\n decode.EXTI2_Trigger = input.bytes[7] & 0x10 ? 'TRUE' : 'FALSE';\n decode.EXTI2_Status = input.bytes[7] & 0x01 ? 'CLOSE' : 'OPEN';\n decode.EXTI3_Trigger = input.bytes[8] & 0x10 ? 'TRUE' : 'FALSE';\n decode.EXTI3_Status = input.bytes[8] & 0x01 ? 'CLOSE' : 'OPEN';\n } else if (mode == '7') {\n decode.Work_mode = '3ADC+1DS18B20';\n decode.ADC_CH1V = ((input.bytes[7] << 8) | input.bytes[8]) / 1000;\n decode.ADC_CH4V = ((input.bytes[9] << 8) | input.bytes[10]) / 1000;\n } else if (mode == '8') {\n decode.Work_mode = '3DS18B20+2Count';\n if (input.bytes[4] == 0x7f && input.bytes[5] == 0xff) decode.TempC2 = 'NULL';\n else decode.TempC2 = parseFloat(((((input.bytes[4] << 24) >> 16) | input.bytes[5]) / 10).toFixed(1));\n\n if (input.bytes[7] == 0x7f && input.bytes[8] == 0xff) decode.TempC3 = 'NULL';\n else decode.TempC3 = parseFloat(((((input.bytes[7] << 24) >> 16) | input.bytes[8]) / 10).toFixed(1));\n\n decode.Count1 = ((input.bytes[9] << 24) | (input.bytes[10] << 16) | (input.bytes[11] << 8) | input.bytes[12]) >>> 0;\n decode.Count2 = ((input.bytes[13] << 24) | (input.bytes[14] << 16) | (input.bytes[15] << 8) | input.bytes[16]) >>> 0;\n }\n\n if (input.bytes.length != 1)\n return {\n data: decode,\n };\n }\n break;\n case 5:\n {\n var decode = {};\n var freq_band;\n var sub_band;\n\n if (input.bytes[0] == 0x01) decode.freq_band = 'EU868';\n else if (input.bytes[0] == 0x02) decode.freq_band = 'US915';\n else if (input.bytes[0] == 0x03) decode.freq_band = 'IN865';\n else if (input.bytes[0] == 0x04) decode.freq_band = 'AU915';\n else if (input.bytes[0] == 0x05) decode.freq_band = 'KZ865';\n else if (input.bytes[0] == 0x06) decode.freq_band = 'RU864';\n else if (input.bytes[0] == 0x07) decode.freq_band = 'AS923';\n else if (input.bytes[0] == 0x08) decode.freq_band = 'AS923_1';\n else if (input.bytes[0] == 0x09) decode.freq_band = 'AS923_2';\n else if (input.bytes[0] == 0x0a) decode.freq_band = 'AS923_3';\n else if (input.bytes[0] == 0x0f) decode.freq_band = 'AS923_4';\n else if (input.bytes[0] == 0x0b) decode.freq_band = 'CN470';\n else if (input.bytes[0] == 0x0c) decode.freq_band = 'EU433';\n else if (input.bytes[0] == 0x0d) decode.freq_band = 'KR920';\n else if (input.bytes[0] == 0x0e) decode.freq_band = 'MA869';\n\n if (input.bytes[1] == 0xff) decode.sub_band = 'NULL';\n else decode.sub_band = input.bytes[1];\n\n decode.firm_ver = (input.bytes[2] & 0x0f) + '.' + ((input.bytes[3] >> 4) & 0x0f) + '.' + (input.bytes[3] & 0x0f);\n\n decode.tdc_time = (input.bytes[4] << 16) | (input.bytes[5] << 8) | input.bytes[6];\n\n return {\n data: decode,\n };\n }\n break;\n default:\n return {\n errors: ['unknown FPort'],\n };\n }\n}\n\nfunction normalizeUplink(input) {\n var data = {};\n var air = {};\n var action = {};\n\n if (input.data.TempC_SHT) {\n air.temperature = input.data.TempC_SHT;\n }\n\n if (input.data.Hum_SHT) {\n air.relativeHumidity = input.data.Hum_SHT;\n }\n\n if (input.data.Door_status === 'CLOSE' || input.data.Door_status === 'OPEN') {\n action.contactState = input.data.Door_status === 'CLOSE' ? 'closed' : 'open';\n }\n\n if (Object.keys(air).length > 0) {\n data.air = air;\n }\n\n if (Object.keys(action).length > 0) {\n data.action = action;\n }\n\n if (input.data.BatV) {\n data.battery = input.data.BatV;\n }\n\n return { data: data };\n}\n",
"environment": "javascript",
"storage": "",
"version": "1.0"
},
"flows": {
"dragino_lsn50_v2_decoder": {
"data": {
"payload": "{{payload}}",
"payload_function": "decodeThingerUplink",
"payload_type": "source_payload",
"resource": "uplink",
"source": "resource",
"update": "events"
},
"enabled": true,
"sink": {
"payload": "{{payload}}",
"payload_type": "source_payload",
"resource_stream": "uplink_decoded",
"target": "resource_stream"
},
"split_data": false
}
},
"properties": {
"uplink": {
"data": {
"payload": "{{payload}}",
"payload_type": "source_payload",
"resource": "uplink",
"source": "resource",
"update": "events"
},
"default": {
"source": "value"
},
"enabled": true
}
}
},
"_resources": {
"properties": [
{
"property": "dashboard",
"value": {
"tabs": [
{
"name": "LSN50-V2 Overview",
"widgets": [
{
"layout": {
"col": 0,
"row": 0,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Battery Voltage"
},
"properties": {
"color": "#27ae60",
"gradient": false,
"icon": "fas fa-battery-full",
"iconColor": "#30a638",
"majorTicks": 10,
"max": 4,
"min": 2,
"plateColor": "#ffffff",
"showValue": true,
"textColor": "#1E313E",
"tickColor": "#000000",
"unit": "V"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "BatV",
"tags": {
"device": [],
"group": []
}
},
"color": "#27ae60",
"name": "Battery",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "gauge"
},
{
"layout": {
"col": 2,
"row": 0,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Temperature (DS18B20)"
},
"properties": {
"color": "#e74c3c",
"max": 85,
"min": -40,
"unit": "°C"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "TempC1",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "Temperature",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "donutchart"
},
{
"layout": {
"col": 4,
"row": 0,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Temperature (SHT)"
},
"properties": {
"color": "#f39c12",
"max": 85,
"min": -40,
"unit": "°C"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "TempC_SHT",
"tags": {
"device": [],
"group": []
}
},
"color": "#f39c12",
"name": "Temp SHT",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "donutchart"
},
{
"layout": {
"col": 0,
"row": 5,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Humidity (SHT)"
},
"properties": {
"color": "#3498db",
"max": 100,
"min": 0,
"unit": "%"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Hum_SHT",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Humidity",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "donutchart"
},
{
"layout": {
"col": 2,
"row": 5,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "ADC CH0 Voltage"
},
"properties": {
"color": "#9b59b6",
"decimals": 3,
"gradient": false,
"max": 3.3,
"min": 0,
"unit": "V"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "ADC_CH0V",
"tags": {
"device": [],
"group": []
}
},
"color": "#9b59b6",
"name": "ADC CH0",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "gauge"
},
{
"layout": {
"col": 4,
"row": 5,
"sizeX": 1,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Door Status"
},
"properties": {
"color": "#95a5a6",
"colorCondition": {
"conditions": [
{
"color": "#4bd763",
"operator": "eq",
"value": "CLOSE"
},
{
"color": "#e74c3c",
"operator": "eq",
"value": "OPEN"
}
],
"enabled": true
},
"size": "75px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Door_status",
"tags": {
"device": [],
"group": []
}
},
"color": "#1abc9c",
"name": "Door",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "led"
},
{
"layout": {
"col": 5,
"row": 5,
"sizeX": 1,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Digital Input"
},
"properties": {
"color": "#95a5a6",
"colorCondition": {
"conditions": [
{
"color": "#4bd763",
"operator": "eq",
"value": "H"
},
{
"color": "#e74c3c",
"operator": "eq",
"value": "L"
}
],
"enabled": true
},
"size": "75px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Digital_IStatus",
"tags": {
"device": [],
"group": []
}
},
"color": "#34495e",
"name": "Digital I",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "led"
},
{
"layout": {
"col": 0,
"row": 10,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Distance"
},
"properties": {
"color": "#16a085",
"decimals": 1,
"max": 4000,
"min": 0,
"unit": "cm"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Distance_cm",
"tags": {
"device": [],
"group": []
}
},
"color": "#16a085",
"name": "Distance",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "donutchart"
},
{
"layout": {
"col": 2,
"row": 10,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Illumination"
},
"properties": {
"color": "#f1c40f",
"gradient": false,
"max": 10000,
"min": 0,
"unit": "lux"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Illum",
"tags": {
"device": [],
"group": []
}
},
"color": "#f1c40f",
"name": "Illumination",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "gauge"
},
{
"layout": {
"col": 4,
"row": 10,
"sizeX": 2,
"sizeY": 5
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Work Mode"
},
"properties": {
"decimalPlaces": 0,
"textAlign": "center",
"textColor": "#1E313E",
"textSize": "30px",
"textWeight": "font-light"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Work_mode",
"tags": {
"device": [],
"group": []
}
},
"color": "#34495e",
"name": "Mode",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 0,
"row": 15,
"sizeX": 3,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Temperature History (24h)"
},
"properties": {
"axis": true,
"fill": false,
"legend": true,
"multiple_axes": false,
"options": "var options = {\n chart: {\n type: 'area'\n },\n dataLabels: {\n enabled: false\n },\n stroke: {\n curve: 'smooth'\n },\n xaxis: {\n type: 'datetime',\n labels: {\n datetimeUTC: false\n },\n tooltip: {\n enabled: false\n }\n },\n yaxis: {\n labels: {\n formatter: function (val) {\n if (val !== null && typeof val !== 'undefined')\n return val.toFixed(1);\n }\n }\n },\n tooltip: {\n x: {\n format: 'dd/MM/yyyy HH:mm:ss'\n }\n }\n};\n"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "TempC1",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "TempC1 (°C)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
},
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "TempC_SHT",
"tags": {
"device": [],
"group": []
}
},
"color": "#f39c12",
"name": "TempC_SHT (°C)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
}
],
"type": "apex_charts"
},
{
"layout": {
"col": 3,
"row": 15,
"sizeX": 3,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Humidity History (24h)"
},
"properties": {
"axis": true,
"fill": true,
"legend": true,
"multiple_axes": false,
"options": "var options = {\n chart: {\n type: 'line',\n zoom: {\n type: 'x',\n enabled: true,\n autoScaleYaxis: true\n }\n },\n stroke: {\n curve: 'smooth',\n width: 3\n },\n xaxis: {\n type: 'datetime',\n labels: {\n datetimeUTC: false\n },\n tooltip: {\n enabled: false\n }\n },\n yaxis: {\n labels: {\n formatter: function (val) {\n if (val !== null && typeof val !== 'undefined')\n return val.toFixed(1);\n }\n },\n min: 0,\n max: 100\n },\n tooltip: {\n x: {\n format: 'dd/MM/yyyy HH:mm:ss'\n }\n }\n};\n"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Hum_SHT",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Humidity (%)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
}
],
"type": "apex_charts"
},
{
"layout": {
"col": 0,
"row": 23,
"sizeX": 3,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Battery History (24h)"
},
"properties": {
"axis": true,
"chartType": "line",
"fill": false,
"legend": false,
"multiple_axes": false
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "BatV",
"tags": {
"device": [],
"group": []
}
},
"color": "#27ae60",
"name": "Battery (V)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
}
],
"type": "chart"
},
{
"layout": {
"col": 3,
"row": 23,
"sizeX": 3,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "ADC Voltage History (24h)"
},
"properties": {
"axis": true,
"chartType": "line",
"fill": false,
"legend": true,
"multiple_axes": false
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "ADC_CH0V",
"tags": {
"device": [],
"group": []
}
},
"color": "#9b59b6",
"name": "ADC CH0 (V)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
},
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "ADC_CH1V",
"tags": {
"device": [],
"group": []
}
},
"color": "#8e44ad",
"name": "ADC CH1 (V)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
}
],
"type": "chart"
}
]
},
{
"name": "Advanced Sensors",
"widgets": [
{
"layout": {
"col": 0,
"row": 0,
"sizeX": 2,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Temperature 2 (DS18B20)"
},
"properties": {
"decimalPlaces": 1,
"textAlign": "center",
"textColor": "#e74c3c",
"textSize": "50px",
"unit": "°C",
"unitSize": "20px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "TempC2",
"tags": {
"device": [],
"group": []
}
},
"color": "#e74c3c",
"name": "TempC2",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 2,
"row": 0,
"sizeX": 2,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Temperature 3 (DS18B20)"
},
"properties": {
"decimalPlaces": 1,
"textAlign": "center",
"textColor": "#c0392b",
"textSize": "50px",
"unit": "°C",
"unitSize": "20px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "TempC3",
"tags": {
"device": [],
"group": []
}
},
"color": "#c0392b",
"name": "TempC3",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 4,
"row": 0,
"sizeX": 2,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Weight"
},
"properties": {
"decimalPlaces": 0,
"textAlign": "center",
"textColor": "#16a085",
"textSize": "50px",
"unit": "units",
"unitSize": "20px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Weight",
"tags": {
"device": [],
"group": []
}
},
"color": "#16a085",
"name": "Weight",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 0,
"row": 4,
"sizeX": 2,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Counter"
},
"properties": {
"decimalPlaces": 0,
"textAlign": "center",
"textColor": "#2980b9",
"textSize": "50px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Count",
"tags": {
"device": [],
"group": []
}
},
"color": "#2980b9",
"name": "Count",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 2,
"row": 4,
"sizeX": 2,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Counter 1"
},
"properties": {
"decimalPlaces": 0,
"textAlign": "center",
"textColor": "#3498db",
"textSize": "50px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Count1",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Count1",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 4,
"row": 4,
"sizeX": 2,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Counter 2"
},
"properties": {
"decimalPlaces": 0,
"textAlign": "center",
"textColor": "#3498db",
"textSize": "50px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Count2",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Count2",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 0,
"row": 8,
"sizeX": 3,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Distance Signal Strength"
},
"properties": {
"decimalPlaces": 0,
"textAlign": "center",
"textColor": "#95a5a6",
"textSize": "50px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Distance_signal_strength",
"tags": {
"device": [],
"group": []
}
},
"color": "#95a5a6",
"name": "Signal",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 3,
"row": 8,
"sizeX": 3,
"sizeY": 4
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "EXTI Trigger"
},
"properties": {
"textAlign": "center",
"textColor": "#34495e",
"textSize": "50px"
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "EXTI_Trigger",
"tags": {
"device": [],
"group": []
}
},
"color": "#34495e",
"name": "EXTI",
"source": "bucket",
"timespan": {
"mode": "latest"
}
}
],
"type": "text"
},
{
"layout": {
"col": 0,
"row": 12,
"sizeX": 3,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Distance & Signal (24h)"
},
"properties": {
"axis": true,
"chartType": "line",
"fill": false,
"legend": true,
"multiple_axes": true
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Distance_cm",
"tags": {
"device": [],
"group": []
}
},
"color": "#16a085",
"name": "Distance (cm)",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
}
],
"type": "chart"
},
{
"layout": {
"col": 3,
"row": 12,
"sizeX": 3,
"sizeY": 8
},
"panel": {
"color": "#ffffff",
"currentColor": "#ffffff",
"showOffline": {
"type": "none"
},
"title": "Counter History (24h)"
},
"properties": {
"axis": true,
"chartType": "line",
"fill": false,
"legend": true,
"multiple_axes": false
},
"sources": [
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Count",
"tags": {
"device": [],
"group": []
}
},
"color": "#2980b9",
"name": "Count",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
},
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Count1",
"tags": {
"device": [],
"group": []
}
},
"color": "#3498db",
"name": "Count1",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
},
{
"bucket": {
"backend": "mongodb",
"id": "dragino_lsn50_v2_data",
"mapping": "Count2",
"tags": {
"device": [],
"group": []
}
},
"color": "#5dade2",
"name": "Count2",
"source": "bucket",
"timespan": {
"magnitude": "hour",
"mode": "relative",
"period": "latest",
"units": "hours",
"value": 24
}
}
],
"type": "chart"
}
]
}
]
}
}
]
}
}
]
}
}