[
    {
        "id": "2b529653bd4eabdd",
        "type": "tab",
        "label": "CC1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "0ca56c5568115f82",
        "type": "mqtt in",
        "z": "2b529653bd4eabdd",
        "name": "",
        "topic": "CC1/temperature",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "10e78a89.5b4fd5",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 180,
        "y": 340,
        "wires": [
            [
                "e80bc6b08daa1f6d",
                "b3c2f8b3c01aad3c",
                "ac91f8118101f0c7"
            ]
        ]
    },
    {
        "id": "e80bc6b08daa1f6d",
        "type": "debug",
        "z": "2b529653bd4eabdd",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 387,
        "y": 307,
        "wires": []
    },
    {
        "id": "4d933856ac1a95b7",
        "type": "mqtt in",
        "z": "2b529653bd4eabdd",
        "name": "",
        "topic": "CC1/humidity",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "10e78a89.5b4fd5",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 169,
        "y": 144,
        "wires": [
            [
                "ad28d5b9c20be3b4",
                "ecc0eee502039b7a",
                "c0938bbbb885efd7",
                "c73a335cca956745"
            ]
        ]
    },
    {
        "id": "ad28d5b9c20be3b4",
        "type": "debug",
        "z": "2b529653bd4eabdd",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 376,
        "y": 111,
        "wires": []
    },
    {
        "id": "ecc0eee502039b7a",
        "type": "ui_gauge",
        "z": "2b529653bd4eabdd",
        "name": "",
        "group": "61285987.c20328",
        "order": 2,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Humidity",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b3d9",
            "#0073e6",
            "#001bd7"
        ],
        "seg1": "33",
        "seg2": "66",
        "diff": false,
        "className": "",
        "x": 366,
        "y": 171,
        "wires": []
    },
    {
        "id": "463c52cb3dde5bbf",
        "type": "mqtt in",
        "z": "2b529653bd4eabdd",
        "name": "",
        "topic": "CC1/CO2",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "10e78a89.5b4fd5",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 149,
        "y": 566,
        "wires": [
            [
                "271b48cb86595fed",
                "fcd45691f87e4ab6",
                "b62ae4cda837ba29"
            ]
        ]
    },
    {
        "id": "271b48cb86595fed",
        "type": "debug",
        "z": "2b529653bd4eabdd",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 376,
        "y": 533,
        "wires": []
    },
    {
        "id": "fcd45691f87e4ab6",
        "type": "ui_chart",
        "z": "2b529653bd4eabdd",
        "name": "",
        "group": "61285987.c20328",
        "order": 3,
        "width": 0,
        "height": 0,
        "label": "CO2",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 356,
        "y": 593,
        "wires": [
            []
        ]
    },
    {
        "id": "09da2c7c51b23ddb",
        "type": "mqtt in",
        "z": "2b529653bd4eabdd",
        "name": "",
        "topic": "CC1/movement",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "10e78a89.5b4fd5",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 169,
        "y": 806,
        "wires": [
            [
                "86f27d4da30db524",
                "ba4637f74d485715",
                "5f3f05b1599b8dc8"
            ]
        ]
    },
    {
        "id": "86f27d4da30db524",
        "type": "debug",
        "z": "2b529653bd4eabdd",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 376,
        "y": 773,
        "wires": []
    },
    {
        "id": "ba4637f74d485715",
        "type": "ui_chart",
        "z": "2b529653bd4eabdd",
        "name": "",
        "group": "61285987.c20328",
        "order": 4,
        "width": 0,
        "height": 0,
        "label": "Movement",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "step",
        "nodata": "",
        "dot": false,
        "ymin": "0",
        "ymax": "1",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 376,
        "y": 833,
        "wires": [
            []
        ]
    },
    {
        "id": "c0938bbbb885efd7",
        "type": "function",
        "z": "2b529653bd4eabdd",
        "name": "Set data",
        "func": "var now = new Date();\n\nmsg.payload = {\n    \"timestamp\" : now.getTime(),\n    \"temperature\" : flow.get(\"temperature/1\"),\n    \"humidity\" : flow.get(\"humidity/1\"),\n    \"CO2\" : flow.get(\"CO2/1\"),\n    \"Movement\" : flow.get(\"movement/1\")\n}\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 726,
        "y": 273,
        "wires": [
            [
                "0f12bce251ea86b5"
            ]
        ]
    },
    {
        "id": "0f12bce251ea86b5",
        "type": "function",
        "z": "2b529653bd4eabdd",
        "name": "Filename generator",
        "func": "// Get the current time and convert it to text\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\n\n// Generate out file name pattern\nmsg.fname = \"ClimateCube1_\"+ yyyy + mm + dd + \".csv\";\n// Full filename with path for the file node later\nmsg.filename = \"/home/ClimateCube/datalog/\"+ msg.fname;\n\n// We save the current payload into a different place on the msg object\nmsg.filecontent = msg.payload;\n\n// We are passing the file name search pattern to fs node to tell us if the file exists or not\nmsg.payload = {\"pattern\":msg.fname};\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.fname});\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 696,
        "y": 393,
        "wires": [
            [
                "0da83c273ad34ac9"
            ]
        ]
    },
    {
        "id": "0deb67d708d34912",
        "type": "debug",
        "z": "2b529653bd4eabdd",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1056,
        "y": 313,
        "wires": []
    },
    {
        "id": "65b93f4369b96d72",
        "type": "switch",
        "z": "2b529653bd4eabdd",
        "name": "",
        "property": "$count(msg.payload)",
        "propertyType": "jsonata",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1036,
        "y": 393,
        "wires": [
            [
                "c9d2b1a88d19d263"
            ],
            [
                "203bc2d4bdfd85c8"
            ]
        ]
    },
    {
        "id": "486667af45ed7445",
        "type": "csv",
        "z": "2b529653bd4eabdd",
        "name": "",
        "sep": ",",
        "hdrin": "",
        "hdrout": "all",
        "multi": "one",
        "ret": "\\n",
        "temp": "timestamp,temperature,humidity,CO2,Movement",
        "skip": "0",
        "strings": true,
        "include_empty_strings": false,
        "include_null_values": false,
        "x": 1376,
        "y": 373,
        "wires": [
            [
                "16d3a0ea9a2e095e"
            ]
        ]
    },
    {
        "id": "16d3a0ea9a2e095e",
        "type": "file",
        "z": "2b529653bd4eabdd",
        "name": "",
        "filename": "filename",
        "filenameType": "msg",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 1536,
        "y": 373,
        "wires": [
            []
        ]
    },
    {
        "id": "4e173c4f5432fd73",
        "type": "csv",
        "z": "2b529653bd4eabdd",
        "name": "",
        "sep": ",",
        "hdrin": "",
        "hdrout": "none",
        "multi": "one",
        "ret": "\\n",
        "temp": "timestamp,temperature,humidity,CO2,Movement",
        "skip": "0",
        "strings": true,
        "include_empty_strings": false,
        "include_null_values": false,
        "x": 1376,
        "y": 413,
        "wires": [
            [
                "16d3a0ea9a2e095e"
            ]
        ]
    },
    {
        "id": "c9d2b1a88d19d263",
        "type": "change",
        "z": "2b529653bd4eabdd",
        "name": "Get file content",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "filecontent",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1206,
        "y": 373,
        "wires": [
            [
                "486667af45ed7445"
            ]
        ]
    },
    {
        "id": "203bc2d4bdfd85c8",
        "type": "change",
        "z": "2b529653bd4eabdd",
        "name": "Get file content",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "filecontent",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1206,
        "y": 413,
        "wires": [
            [
                "4e173c4f5432fd73"
            ]
        ]
    },
    {
        "id": "0da83c273ad34ac9",
        "type": "fs-file-lister",
        "z": "2b529653bd4eabdd",
        "name": "",
        "start": "/home/ClimateCube/datalog/",
        "pattern": "",
        "folders": "*",
        "hidden": true,
        "lstype": "files",
        "path": true,
        "single": true,
        "depth": 0,
        "stat": true,
        "showWarnings": false,
        "x": 886,
        "y": 393,
        "wires": [
            [
                "0deb67d708d34912",
                "65b93f4369b96d72"
            ]
        ]
    },
    {
        "id": "b3c2f8b3c01aad3c",
        "type": "change",
        "z": "2b529653bd4eabdd",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "temperature/1",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 416,
        "y": 433,
        "wires": [
            []
        ]
    },
    {
        "id": "c73a335cca956745",
        "type": "change",
        "z": "2b529653bd4eabdd",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "humidity/1",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 406,
        "y": 233,
        "wires": [
            []
        ]
    },
    {
        "id": "b62ae4cda837ba29",
        "type": "change",
        "z": "2b529653bd4eabdd",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "CO2/1",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 396,
        "y": 653,
        "wires": [
            []
        ]
    },
    {
        "id": "5f3f05b1599b8dc8",
        "type": "change",
        "z": "2b529653bd4eabdd",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "movement/1",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 406,
        "y": 893,
        "wires": [
            []
        ]
    },
    {
        "id": "ac91f8118101f0c7",
        "type": "ui_chart",
        "z": "2b529653bd4eabdd",
        "name": "",
        "group": "61285987.c20328",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "Temperature",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "20",
        "ymax": "40",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 416,
        "y": 373,
        "wires": [
            []
        ]
    },
    {
        "id": "10e78a89.5b4fd5",
        "type": "mqtt-broker",
        "name": "",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": 4,
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    },
    {
        "id": "61285987.c20328",
        "type": "ui_group",
        "name": "CC1",
        "tab": "e7c46d5e.a1283",
        "order": 1,
        "disp": true,
        "width": 7,
        "collapse": false,
        "className": ""
    },
    {
        "id": "e7c46d5e.a1283",
        "type": "ui_tab",
        "name": "Dashboard",
        "icon": "dashboard"
    }
]