Skip to content

Plugin file

Plugin configuration file
{
  "name": "dragino_wsc1_l",
  "version": "1.0.0",
  "description": "WSC1-L is the main process unit in Dragino Weather Station solution.",
  "author": "Thinger.io",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/thinger-io/plugins.git",
    "directory": "dragino-wsc1-l"
  },
  "metadata": {
    "name": "Dragino WSC1-L",
    "description": "WSC1-L is the main process unit in Dragino Weather Station solution.",
    "image": "assets/wsc1-l.png",
    "category": "devices",
    "vendor": "dragino"
  },
  "resources": {
    "products": [
      {
        "description": "WSC1-L is the main process unit in Dragino Weather Station solution.",
        "enabled": true,
        "name": "Dragino WSC1-L",
        "product": "dragino_wsc1_l",
        "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}",
                  "payload_type": "",
                  "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": "wsc1_l_.*"
              },
              "enabled": true
            }
          },
          "buckets": {
            "dragino_wsc1_l_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 zxc(num) {\n  if (parseInt(num) < 10) num = '0' + num;\n  return num;\n}\n\nfunction decodeUplink(input) {\n  var port = input.fPort;\n  var bytes = input.bytes;\n  var data = {};\n  switch (input.fPort) {\n    case 2:\n      {\n        if (bytes[0] < 0xe0) {\n          var direction = { 0: 'N', 1: 'NNE', 2: 'NE', 3: 'ENE', 4: 'E', 5: 'ESE', 6: 'SE', 7: 'SSE', 8: 'S', 9: 'SSW', 10: 'SW', 11: 'WSW', 12: 'W', 13: 'WNW', 14: 'NW', 15: 'NNW' };\n          var dic = {};\n          var sensor = ['bat', 'wind_speed', 'wind_direction_angle', 'illumination', 'rain_snow', 'CO2', 'TEM', 'HUM', 'pressure', 'rain_gauge', 'PM2_5', 'PM10', 'PAR', 'TSR'];\n          var sensor_diy = ['A1', 'A2', 'A3', 'A4'];\n          var algorithm = [0x03, 0x01, 0x01, 0x11, 0x20, 0x20, 0x01, 0x01, 0x01, 0x01, 0x20, 0x20, 0x20, 0x01];\n          for (i = 0; i < bytes.length; ) {\n            var len = bytes[i + 1];\n            if (bytes[i] < 0xa1) {\n              var sensor_type = bytes[i];\n              var operation = algorithm[sensor_type] >> 4;\n              var count = algorithm[sensor_type] & 0x0f;\n\n              if (operation === 0) {\n                if (sensor_type === 0x06) {\n                  //TEM\n                  if (bytes[i + 2] & 0x80)\n                    dic[sensor[sensor_type]] = (((bytes[i + 2] << 8) | bytes[i + 3]) - 0xffff) / (count * 10.0); //<0\n                  else dic[sensor[sensor_type]] = ((bytes[i + 2] << 8) | bytes[i + 3]) / (count * 10.0);\n                } else dic[sensor[sensor_type]] = ((bytes[i + 2] << 8) | bytes[i + 3]) / (count * 10.0);\n              } else if (operation === 1) {\n                dic[sensor[sensor_type]] = ((bytes[i + 2] << 8) | bytes[i + 3]) * (count * 10);\n              } else {\n                if (sensor_type === 0x04)\n                  //RAIN_SNOW\n                  dic[sensor[sensor_type]] = bytes[i + 2];\n                else dic[sensor[sensor_type]] = (bytes[i + 2] << 8) | bytes[i + 3];\n              }\n\n              if (sensor_type === 0x01) {\n                dic.wind_speed_level = bytes[i + 4];\n              } else if (sensor_type === 0x02) {\n                values = bytes[i + 4];\n                dic.wind_direction = direction[values];\n              }\n            } else {\n              dic[sensor_diy[bytes[i] - 0xa1]] = (bytes[i + 2] << 8) | bytes[i + 3];\n            }\n\n            i = i + 2 + len;\n          }\n        }\n      }\n      return {\n        data: dic,\n      };\n      break;\n\n    case 5:\n      {\n        var frequency = { 1: 'EU868', 2: 'US915', 3: 'IN865', 4: 'AU915', 5: 'KZ865', 6: 'RU864', 7: 'AS923', 8: 'AS923-1', 9: 'AS923-2', 10: 'AS923-3' };\n        {\n          var node = bytes[0];\n          if (node === 13);\n          data.node = 'WSC1-L';\n          var version1 = bytes[1],\n            version2 = bytes[2] >> 4,\n            version3 = bytes[2] & 0x0f;\n          data.version = 'V' + '.' + version1 + '.' + version2 + '.' + version3;\n          var values = bytes[3];\n          data.frequency_band = frequency[values];\n          data.sub_band = bytes[4];\n          data.bat = ((bytes[5] << 8) | bytes[6]) / 1000;\n          data.weather_sensor_types = bytes[7].toString(16) + zxc(bytes[8].toString(16)) + bytes[9].toString(16);\n        }\n      }\n      return {\n        data: data,\n      };\n      break;\n\n    default:\n      return {\n        errors: ['unknown FPort'],\n      };\n  }\n}\n",
            "environment": "javascript",
            "storage": "",
            "version": "1.0"
          },
          "flows": {
            "dragino_wsc1_l_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": "Weather Station",
                    "widgets": [
                      {
                        "layout": {
                          "col": 0,
                          "row": 0,
                          "sizeX": 6,
                          "sizeY": 3
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Device Information"
                        },
                        "properties": {
                          "decimalPlaces": 2,
                          "textAlign": "center",
                          "textColor": "#1E313E",
                          "textSize": "18px",
                          "textWeight": "font-light",
                          "unit": "",
                          "unitSize": "14px"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "node",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#3498db",
                            "name": "Node",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "text"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 3,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Battery"
                        },
                        "properties": {
                          "color": "#27ae60",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 4,
                          "min": 2,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "V"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "bat",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#27ae60",
                            "name": "Battery",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 2,
                          "row": 3,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Temperature"
                        },
                        "properties": {
                          "color": "#e74c3c",
                          "max": 85,
                          "min": -40,
                          "unit": "°C"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "TEM",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e74c3c",
                            "name": "Temperature",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "donutchart"
                      },
                      {
                        "layout": {
                          "col": 4,
                          "row": 3,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Humidity"
                        },
                        "properties": {
                          "color": "#3498db",
                          "max": 100,
                          "min": 0,
                          "unit": "%"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "HUM",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#3498db",
                            "name": "Humidity",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "donutchart"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 8,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Wind Speed"
                        },
                        "properties": {
                          "color": "#1abc9c",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 150,
                          "min": 0,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "km/h"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "wind_speed",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#1abc9c",
                            "name": "Wind Speed",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 2,
                          "row": 8,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Wind Direction"
                        },
                        "properties": {
                          "decimalPlaces": 0,
                          "textAlign": "center",
                          "textColor": "#16a085",
                          "textSize": "48px",
                          "textWeight": "font-bold",
                          "unit": "",
                          "unitSize": "20px"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "wind_direction",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#16a085",
                            "name": "Direction",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "text"
                      },
                      {
                        "layout": {
                          "col": 4,
                          "row": 8,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Pressure"
                        },
                        "properties": {
                          "color": "#9b59b6",
                          "max": 1100,
                          "min": 900,
                          "unit": "hPa"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "pressure",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#9b59b6",
                            "name": "Pressure",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "donutchart"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 13,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Illumination"
                        },
                        "properties": {
                          "color": "#f39c12",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 100000,
                          "min": 0,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "lux"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "illumination",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#f39c12",
                            "name": "Illumination",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 2,
                          "row": 13,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Rain Gauge"
                        },
                        "properties": {
                          "color": "#3498db",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 500,
                          "min": 0,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "mm"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "rain_gauge",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#3498db",
                            "name": "Rain",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 4,
                          "row": 13,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "CO2"
                        },
                        "properties": {
                          "color": "#e67e22",
                          "max": 5000,
                          "min": 0,
                          "unit": "ppm"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "CO2",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e67e22",
                            "name": "CO2",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "donutchart"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 18,
                          "sizeX": 3,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Temperature & Humidity (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(2);\n            }\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    }\n};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "TEM",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e74c3c",
                            "name": "Temperature (°C)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          },
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "HUM",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#3498db",
                            "name": "Humidity (%)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      },
                      {
                        "layout": {
                          "col": 3,
                          "row": 18,
                          "sizeX": 3,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Wind Speed (24h)"
                        },
                        "properties": {
                          "axis": true,
                          "fill": false,
                          "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            allowMouseWheelZoom: false\n        },\n        toolbar: {\n            autoSelected: 'zoom'\n        }\n    },\n    stroke: {\n        curve: 'straight',\n        width: 4\n    },\n    markers: {\n        size: 5,\n        hover: {\n            sizeOffset: 2\n        }\n    },\n    grid: {\n        row: {\n            colors: ['#f3f3f3', 'transparent'],\n            opacity: 0.5\n        }\n    },\n    xaxis: {\n        type: 'datetime',\n        tooltip: {\n            enabled: false\n        },\n        labels: {\n            datetimeUTC: false\n        }\n    },\n    yaxis: {\n        labels: {\n            formatter: function (val) {\n                if (val !== null && typeof val !== 'undefined')\n                    return val.toFixed(2);\n            }\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    }\n};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "wind_speed",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#1abc9c",
                            "name": "Wind Speed (km/h)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 26,
                          "sizeX": 3,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Pressure (24h)"
                        },
                        "properties": {
                          "axis": true,
                          "fill": true,
                          "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};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "pressure",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#9b59b6",
                            "name": "Pressure (hPa)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      },
                      {
                        "layout": {
                          "col": 3,
                          "row": 26,
                          "sizeX": 3,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Rain Gauge (24h)"
                        },
                        "properties": {
                          "axis": true,
                          "fill": false,
                          "legend": true,
                          "multiple_axes": false,
                          "options": "var options = {\n    chart: {\n        type: 'line'\n    },\n    dataLabels: {\n        enabled: false\n    },\n    stroke: {\n        curve: 'stepline',\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    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    }\n};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "rain_gauge",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#3498db",
                            "name": "Rain (mm)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      }
                    ]
                  },
                  {
                    "name": "Air Quality",
                    "widgets": [
                      {
                        "layout": {
                          "col": 0,
                          "row": 0,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "PM2.5"
                        },
                        "properties": {
                          "color": "#e74c3c",
                          "max": 500,
                          "min": 0,
                          "unit": "μg/m³"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "PM2_5",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e74c3c",
                            "name": "PM2.5",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "donutchart"
                      },
                      {
                        "layout": {
                          "col": 2,
                          "row": 0,
                          "sizeX": 2,
                          "sizeY": 5
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "PM10"
                        },
                        "properties": {
                          "color": "#e67e22",
                          "max": 600,
                          "min": 0,
                          "unit": "μg/m³"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "PM10",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e67e22",
                            "name": "PM10",
                            "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": "CO2"
                        },
                        "properties": {
                          "color": "#95a5a6",
                          "max": 5000,
                          "min": 0,
                          "unit": "ppm"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "CO2",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#95a5a6",
                            "name": "CO2",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "donutchart"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 5,
                          "sizeX": 6,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Particulate Matter (24h)"
                        },
                        "properties": {
                          "axis": true,
                          "fill": false,
                          "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    markers: {\n        size: 4\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};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "PM2_5",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e74c3c",
                            "name": "PM2.5 (μg/m³)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          },
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "PM10",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e67e22",
                            "name": "PM10 (μg/m³)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 13,
                          "sizeX": 6,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "CO2 Level (24h)"
                        },
                        "properties": {
                          "axis": true,
                          "fill": true,
                          "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(0);\n            }\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    }\n};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "CO2",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#95a5a6",
                            "name": "CO2 (ppm)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      }
                    ]
                  },
                  {
                    "name": "Solar Radiation",
                    "widgets": [
                      {
                        "layout": {
                          "col": 0,
                          "row": 0,
                          "sizeX": 2,
                          "sizeY": 6
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "PAR"
                        },
                        "properties": {
                          "color": "#f1c40f",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 3000,
                          "min": 0,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "μmol/m²/s"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "PAR",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#f1c40f",
                            "name": "PAR",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 2,
                          "row": 0,
                          "sizeX": 2,
                          "sizeY": 6
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Total Solar Radiation"
                        },
                        "properties": {
                          "color": "#e67e22",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 2000,
                          "min": 0,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "W/m²"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "TSR",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e67e22",
                            "name": "TSR",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 4,
                          "row": 0,
                          "sizeX": 2,
                          "sizeY": 6
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Illumination"
                        },
                        "properties": {
                          "color": "#f39c12",
                          "gradient": false,
                          "majorTicks": 10,
                          "max": 100000,
                          "min": 0,
                          "plateColor": "#ffffff",
                          "showValue": true,
                          "textColor": "#1E313E",
                          "tickColor": "#000000",
                          "unit": "lux"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "illumination",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#f39c12",
                            "name": "Illumination",
                            "source": "bucket",
                            "timespan": {
                              "mode": "latest"
                            }
                          }
                        ],
                        "type": "gauge"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 6,
                          "sizeX": 6,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Solar Radiation (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        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    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    }\n};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "PAR",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#f1c40f",
                            "name": "PAR (μmol/m²/s)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          },
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "TSR",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#e67e22",
                            "name": "TSR (W/m²)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      },
                      {
                        "layout": {
                          "col": 0,
                          "row": 14,
                          "sizeX": 6,
                          "sizeY": 8
                        },
                        "panel": {
                          "color": "#ffffff",
                          "currentColor": "#ffffff",
                          "showOffline": {
                            "type": "none"
                          },
                          "title": "Illumination (24h)"
                        },
                        "properties": {
                          "axis": true,
                          "fill": true,
                          "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(0);\n            }\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    }\n};"
                        },
                        "sources": [
                          {
                            "bucket": {
                              "backend": "mongodb",
                              "id": "dragino_wsc1_l_data",
                              "mapping": "illumination",
                              "tags": {
                                "device": [],
                                "group": []
                              }
                            },
                            "color": "#f39c12",
                            "name": "Illumination (lux)",
                            "source": "bucket",
                            "timespan": {
                              "magnitude": "hour",
                              "mode": "relative",
                              "period": "latest",
                              "value": 24
                            }
                          }
                        ],
                        "type": "apex_charts"
                      }
                    ]
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}