Skip to content

Plugin file

Plugin configuration file
{
    "name": "milesight-iot-vs133",
    "version": "1.0.0",
    "description": "VS133 is a sensor that uses second-generation ToF technology to accurately count people with an excellent privacy protection",
    "author": "Thinger.io",
    "license": "MIT",
    "repository": {
        "type": "git",
        "url": "https://github.com/thinger-io/plugins.git",
        "directory": "milesight-iot-vs133"
    },
    "metadata": {
        "name": "Milesight-Iot VS133",
        "description": "VS133 is a sensor that uses second-generation ToF technology to accurately count people with an excellent privacy protection",
        "image": "assets/vs133.png",
        "category": "devices",
        "vendor": "milesight-iot"
    },
    "resources": {
        "products": [
            {
                "description": "VS133 is a sensor that uses second-generation ToF technology to accurately count people with an excellent privacy protection",
                "enabled": true,
                "name": "Milesight-Iot VS133",
                "product": "milesight_iot_vs133",
                "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": "vs133_.*"
                            },
                            "enabled": true
                        }
                    },
                    "buckets": {
                        "milesight_vs133_data": {
                            "backend": "mongodb",
                            "data": {
                                "payload": "{{payload}}",
                                "payload_type": "source_payload",
                                "resource_stream": "uplink_decoded",
                                "source": "resource_stream"
                            },
                            "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 res = Decoder(input.bytes, input.fPort);\n    if (res.error) {\n        return {\n            errors: [res.error],\n        };\n    }\n    return {\n        data: res,\n    };\n}\n/**\n * Payload Decoder for The Things Network\n *\n * Copyright 2023 Milesight IoT\n *\n * @product VS133\n */\nfunction Decoder(bytes, port) {\n    return milesight(bytes);\n}\n\ntotal_in_chns = [0x03, 0x06, 0x09, 0x0c];\ntotal_out_chns = [0x04, 0x07, 0x0a, 0x0d];\nperiod_chns = [0x05, 0x08, 0x0b, 0x0e];\n\nfunction milesight(bytes) {\n    var decoded = {};\n\n    for (var i = 0; i < bytes.length; ) {\n        var channel_id = bytes[i++];\n        var channel_type = bytes[i++];\n\n        // LINE TOTAL IN\n        if (includes(total_in_chns, channel_id) && channel_type === 0xd2) {\n            var channel_in_name = \"line_\" + ((channel_id - total_in_chns[0]) / 3 + 1);\n            decoded[channel_in_name] = decoded[channel_in_name] || {};\n            decoded[channel_in_name].total_in = readUInt32LE(bytes.slice(i, i + 4));\n            i += 4;\n        }\n        // LINE TOTAL OUT\n        else if (includes(total_out_chns, channel_id) && channel_type === 0xd2) {\n            var channel_out_name = \"line_\" + ((channel_id - total_out_chns[0]) / 3 + 1);\n            decoded[channel_out_name] = decoded[channel_out_name] || {};\n            decoded[channel_out_name].total_out = readUInt32LE(bytes.slice(i, i + 4));\n            i += 4;\n        }\n        // LINE PERIOD\n        else if (includes(period_chns, channel_id) && channel_type === 0xcc) {\n            var channel_period_name = \"line_\" + ((channel_id - period_chns[0]) / 3 + 1);\n            decoded[channel_period_name] = decoded[channel_period_name] || {};\n            decoded[channel_period_name].period_in = readUInt16LE(bytes.slice(i, i + 2));\n            decoded[channel_period_name].period_out = readUInt16LE(bytes.slice(i + 2, i + 4));\n            i += 4;\n        } else {\n            break;\n        }\n    }\n\n    return decoded;\n}\n\nfunction readUInt8LE(bytes) {\n    return bytes & 0xff;\n}\n\nfunction readUInt16LE(bytes) {\n    var value = (bytes[1] << 8) + bytes[0];\n    return value & 0xffff;\n}\n\nfunction readUInt32LE(bytes) {\n    var value = (bytes[3] << 24) + (bytes[2] << 16) + (bytes[1] << 8) + bytes[0];\n    return (value & 0xffffffff) >>> 0;\n}\n\nfunction includes(datas, value) {\n    var size = datas.length;\n    for (var i = 0; i < size; i++) {\n        if (datas[i] == value) {\n            return true;\n        }\n    }\n    return false;\n}\n",
                        "environment": "javascript",
                        "storage": "",
                        "version": "1.0"
                    },
                    "flows": {
                        "milesight_vs133_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": "People Counting",
                                        "widgets": [
                                            {
                                                "layout": {
                                                    "col": 0,
                                                    "row": 0,
                                                    "sizeX": 2,
                                                    "sizeY": 5
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "Line 1 - Total In"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableExtraTextColor": false,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "extraText": "People",
                                                    "extraTextColor": "#1E313E",
                                                    "extraTextColorConditions": [],
                                                    "extraTextConditions": [],
                                                    "extraTextPosition": "below-value",
                                                    "extraTextSize": "20px",
                                                    "extraTextWeight": "font-light",
                                                    "icon": "fas fa-sign-in-alt",
                                                    "iconColor": "#2ecc71",
                                                    "iconColorConditions": [],
                                                    "iconConditions": [],
                                                    "iconGap": "8px",
                                                    "iconPosition": "before-value",
                                                    "iconSize": "35px",
                                                    "iconVerticalOffset": "0px",
                                                    "link": "",
                                                    "textAlign": "center",
                                                    "textColor": "#1E313E",
                                                    "textColorConditions": [],
                                                    "textConditions": [],
                                                    "textSize": "75px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "20px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 2,
                                                    "row": 0,
                                                    "sizeX": 2,
                                                    "sizeY": 5
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "Line 1 - Total Out"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableExtraTextColor": false,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "extraText": "People",
                                                    "extraTextColor": "#1E313E",
                                                    "extraTextColorConditions": [],
                                                    "extraTextConditions": [],
                                                    "extraTextPosition": "below-value",
                                                    "extraTextSize": "20px",
                                                    "extraTextWeight": "font-light",
                                                    "icon": "fas fa-sign-out-alt",
                                                    "iconColor": "#e74c3c",
                                                    "iconColorConditions": [],
                                                    "iconConditions": [],
                                                    "iconGap": "8px",
                                                    "iconPosition": "before-value",
                                                    "iconSize": "35px",
                                                    "iconVerticalOffset": "0px",
                                                    "link": "",
                                                    "textAlign": "center",
                                                    "textColor": "#1E313E",
                                                    "textColorConditions": [],
                                                    "textSize": "75px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "20px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 4,
                                                    "row": 0,
                                                    "sizeX": 2,
                                                    "sizeY": 5
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "Line 1 - Current Occupancy"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableExtraTextColor": false,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "extraText": "People Inside",
                                                    "extraTextColor": "#1E313E",
                                                    "extraTextColorConditions": [],
                                                    "extraTextConditions": [],
                                                    "extraTextPosition": "below-value",
                                                    "extraTextSize": "20px",
                                                    "extraTextWeight": "font-light",
                                                    "icon": "fas fa-users",
                                                    "iconColor": "#3498db",
                                                    "iconColorConditions": [],
                                                    "iconConditions": [],
                                                    "iconGap": "8px",
                                                    "iconPosition": "before-value",
                                                    "iconSize": "35px",
                                                    "iconVerticalOffset": "0px",
                                                    "link": "",
                                                    "textAlign": "center",
                                                    "textColor": "#1E313E",
                                                    "textColorConditions": [],
                                                    "textSize": "75px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "20px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    },
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Out",
                                                        "processing": {
                                                            "output": "return (value['In'] || 0) - (value['Out'] || 0);"
                                                        },
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 0,
                                                    "row": 5,
                                                    "sizeX": 6,
                                                    "sizeY": 10
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "Line 1 - People Flow (24h)"
                                                },
                                                "properties": {
                                                    "alignTimeSeries": false,
                                                    "dataAppend": false,
                                                    "options": "var options = {\n    chart: {\n        type: 'line',\n        stacked: false,\n        zoom: {\n            enabled: true\n        }\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        title: {\n            text: 'Total Count'\n        },\n        labels: {\n            formatter: function (val) {\n                return val ? val.toFixed(0) : 0;\n            }\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    },\n    legend: {\n        position: 'top'\n    }\n};\n",
                                                    "realTimeUpdate": true
                                                },
                                                "sources": [
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Total In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    },
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Total Out",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    }
                                                ],
                                                "type": "apex_charts"
                                            },
                                            {
                                                "layout": {
                                                    "col": 0,
                                                    "row": 15,
                                                    "sizeX": 6,
                                                    "sizeY": 10
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "Line 1 - Period Traffic (24h)"
                                                },
                                                "properties": {
                                                    "alignTimeSeries": false,
                                                    "dataAppend": false,
                                                    "options": "var options = {\n    chart: {\n        type: 'bar',\n        stacked: true\n    },\n    dataLabels: {\n        enabled: false\n    },\n    plotOptions: {\n        bar: {\n            horizontal: false,\n            columnWidth: '70%'\n        }\n    },\n    xaxis: {\n        type: 'datetime',\n        labels: {\n            datetimeUTC: false\n        },\n        tooltip: {\n            enabled: false\n        }\n    },\n    yaxis: {\n        title: {\n            text: 'People Count'\n        },\n        labels: {\n            formatter: function (val) {\n                return val ? val.toFixed(0) : 0;\n            }\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    },\n    legend: {\n        position: 'top'\n    }\n};\n",
                                                    "realTimeUpdate": true
                                                },
                                                "sources": [
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.period_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Period In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    },
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.period_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Period Out",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    }
                                                ],
                                                "type": "apex_charts"
                                            }
                                        ]
                                    },
                                    {
                                        "name": "Multi-Line View",
                                        "widgets": [
                                            {
                                                "layout": {
                                                    "col": 1,
                                                    "row": 0,
                                                    "sizeX": 2,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L1 In"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-right",
                                                    "iconColor": "#2ecc71",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#2ecc71",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 0,
                                                    "row": 0,
                                                    "sizeX": 1,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L1 Out"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-left",
                                                    "iconColor": "#e74c3c",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#e74c3c",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 1,
                                                    "row": 4,
                                                    "sizeX": 2,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L2 In"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-right",
                                                    "iconColor": "#2ecc71",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#2ecc71",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_2.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 0,
                                                    "row": 4,
                                                    "sizeX": 1,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L2 Out"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-left",
                                                    "iconColor": "#e74c3c",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#e74c3c",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_2.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 5,
                                                    "row": 0,
                                                    "sizeX": 1,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L3 In"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-right",
                                                    "iconColor": "#2ecc71",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#2ecc71",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_3.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 3,
                                                    "row": 0,
                                                    "sizeX": 2,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L3 Out"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-left",
                                                    "iconColor": "#e74c3c",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#e74c3c",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_3.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 5,
                                                    "row": 4,
                                                    "sizeX": 1,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L4 In"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-right",
                                                    "iconColor": "#2ecc71",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#2ecc71",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_4.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 3,
                                                    "row": 4,
                                                    "sizeX": 2,
                                                    "sizeY": 4
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "L4 Out"
                                                },
                                                "properties": {
                                                    "decimalPlaces": 0,
                                                    "enableIconColor": true,
                                                    "enableIconSize": true,
                                                    "icon": "fas fa-arrow-left",
                                                    "iconColor": "#e74c3c",
                                                    "iconGap": "8px",
                                                    "iconPosition": "above-value",
                                                    "iconSize": "25px",
                                                    "textAlign": "center",
                                                    "textColor": "#e74c3c",
                                                    "textSize": "40px",
                                                    "textWeight": "font-light",
                                                    "unit": "",
                                                    "unitSize": "16px"
                                                },
                                                "sources": [
                                                    {
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_4.total_out",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#e74c3c",
                                                        "name": "Source 1",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "mode": "latest"
                                                        }
                                                    }
                                                ],
                                                "type": "text"
                                            },
                                            {
                                                "layout": {
                                                    "col": 0,
                                                    "row": 8,
                                                    "sizeX": 6,
                                                    "sizeY": 10
                                                },
                                                "panel": {
                                                    "color": "#ffffff",
                                                    "currentColor": "#ffffff",
                                                    "showOffline": {
                                                        "type": "none"
                                                    },
                                                    "title": "All Lines - Total Traffic Comparison (24h)"
                                                },
                                                "properties": {
                                                    "alignTimeSeries": false,
                                                    "dataAppend": false,
                                                    "options": "var options = {\n    chart: {\n        type: 'line',\n        stacked: false\n    },\n    dataLabels: {\n        enabled: false\n    },\n    stroke: {\n        curve: 'smooth',\n        width: 2\n    },\n    xaxis: {\n        type: 'datetime',\n        labels: {\n            datetimeUTC: false\n        },\n        tooltip: {\n            enabled: false\n        }\n    },\n    yaxis: {\n        title: {\n            text: 'Total Count'\n        }\n    },\n    tooltip: {\n        x: {\n            format: 'dd/MM/yyyy HH:mm:ss'\n        }\n    },\n    legend: {\n        position: 'top'\n    }\n};\n",
                                                    "realTimeUpdate": true
                                                },
                                                "sources": [
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_1.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#2ecc71",
                                                        "name": "Line 1 In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    },
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_2.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#3498db",
                                                        "name": "Line 2 In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    },
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_3.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#9b59b6",
                                                        "name": "Line 3 In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    },
                                                    {
                                                        "aggregation": {},
                                                        "bucket": {
                                                            "backend": "mongodb",
                                                            "id": "milesight_vs133_data",
                                                            "mapping": "line_4.total_in",
                                                            "tags": {
                                                                "device": [],
                                                                "group": []
                                                            }
                                                        },
                                                        "color": "#f39c12",
                                                        "name": "Line 4 In",
                                                        "source": "bucket",
                                                        "timespan": {
                                                            "magnitude": "hour",
                                                            "mode": "relative",
                                                            "period": "latest",
                                                            "value": 24
                                                        }
                                                    }
                                                ],
                                                "type": "apex_charts"
                                            }
                                        ]
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
}