[
    {
        "id": "a51bc4e1b7f68968",
        "type": "tab",
        "label": "Chamber",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9d6e7fb389bd4882",
        "type": "mqtt in",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "topic": "chamber/temp",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "10e78a89.5b4fd5",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 190,
        "y": 200,
        "wires": [
            [
                "57f66282e6b1d788",
                "1e4b86b581d9fcb6",
                "33df4b5084943bfd",
                "3e77b5902ec2e0c2"
            ]
        ]
    },
    {
        "id": "1e4b86b581d9fcb6",
        "type": "ui_chart",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "group": "b899f73c516e71bd",
        "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": 530,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "57f66282e6b1d788",
        "type": "ui_text",
        "z": "a51bc4e1b7f68968",
        "group": "b899f73c516e71bd",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "temp",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 510,
        "y": 260,
        "wires": []
    },
    {
        "id": "33df4b5084943bfd",
        "type": "debug",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 180,
        "wires": []
    },
    {
        "id": "21b32380306c2518",
        "type": "mqtt in",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "topic": "chamber/humidity",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "10e78a89.5b4fd5",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 210,
        "y": 380,
        "wires": [
            [
                "335dd19d3b8a259d",
                "706e8394499a6a2f",
                "b326ead4b466c162",
                "72a90db3dbeb57cf",
                "9b3aa9b421dd6ec2"
            ]
        ]
    },
    {
        "id": "706e8394499a6a2f",
        "type": "ui_chart",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "group": "b899f73c516e71bd",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "Humitidy",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "0",
        "ymax": "60",
        "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": 510,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "335dd19d3b8a259d",
        "type": "ui_text",
        "z": "a51bc4e1b7f68968",
        "group": "b899f73c516e71bd",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Humitidy",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 490,
        "y": 440,
        "wires": []
    },
    {
        "id": "b326ead4b466c162",
        "type": "debug",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 520,
        "y": 360,
        "wires": []
    },
    {
        "id": "9b3aa9b421dd6ec2",
        "type": "function",
        "z": "a51bc4e1b7f68968",
        "name": "Set data",
        "func": "var now = new Date();\n\nmsg.payload = {\n    \"timestamp\" : now.getTime(),\n    \"temperature\" : flow.get(\"chamber/temp\"),\n    \"humidity\" : flow.get(\"chamber/hu\")\n}\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 520,
        "y": 680,
        "wires": [
            [
                "96cd9a1a4db0ebd9"
            ]
        ]
    },
    {
        "id": "96cd9a1a4db0ebd9",
        "type": "function",
        "z": "a51bc4e1b7f68968",
        "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 = \"Chamber_\"+ 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": 490,
        "y": 800,
        "wires": [
            [
                "ce847b4593b6decc"
            ]
        ]
    },
    {
        "id": "11e5333553c1acd4",
        "type": "debug",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 850,
        "y": 720,
        "wires": []
    },
    {
        "id": "59561e594485bef3",
        "type": "switch",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "property": "$count(msg.payload)",
        "propertyType": "jsonata",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 830,
        "y": 800,
        "wires": [
            [
                "5210d04e7f21955c"
            ],
            [
                "371a40128fec2b67"
            ]
        ]
    },
    {
        "id": "b19108efcf76d320",
        "type": "csv",
        "z": "a51bc4e1b7f68968",
        "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": 1170,
        "y": 780,
        "wires": [
            [
                "5b67f35d877b0d29"
            ]
        ]
    },
    {
        "id": "5b67f35d877b0d29",
        "type": "file",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "filename": "filename",
        "filenameType": "msg",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 1330,
        "y": 780,
        "wires": [
            []
        ]
    },
    {
        "id": "644822a0f010c550",
        "type": "csv",
        "z": "a51bc4e1b7f68968",
        "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": 1170,
        "y": 820,
        "wires": [
            [
                "5b67f35d877b0d29"
            ]
        ]
    },
    {
        "id": "5210d04e7f21955c",
        "type": "change",
        "z": "a51bc4e1b7f68968",
        "name": "Get file content",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "filecontent",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 780,
        "wires": [
            [
                "b19108efcf76d320"
            ]
        ]
    },
    {
        "id": "371a40128fec2b67",
        "type": "change",
        "z": "a51bc4e1b7f68968",
        "name": "Get file content",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "filecontent",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 820,
        "wires": [
            [
                "644822a0f010c550"
            ]
        ]
    },
    {
        "id": "ce847b4593b6decc",
        "type": "fs-file-lister",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "start": "/home/ClimateCube/datalog/",
        "pattern": "",
        "folders": "*",
        "hidden": true,
        "lstype": "files",
        "path": true,
        "single": true,
        "depth": 0,
        "stat": true,
        "showWarnings": false,
        "x": 680,
        "y": 800,
        "wires": [
            [
                "11e5333553c1acd4",
                "59561e594485bef3"
            ]
        ]
    },
    {
        "id": "3e77b5902ec2e0c2",
        "type": "change",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "chamber/temp",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "72a90db3dbeb57cf",
        "type": "change",
        "z": "a51bc4e1b7f68968",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "chamber/hu",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 500,
        "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": "b899f73c516e71bd",
        "type": "ui_group",
        "name": "Chamber",
        "tab": "e7c46d5e.a1283",
        "order": 5,
        "disp": true,
        "width": 6,
        "collapse": false,
        "className": ""
    },
    {
        "id": "e7c46d5e.a1283",
        "type": "ui_tab",
        "name": "Dashboard",
        "icon": "dashboard"
    }
]