[
    {
        "id": "13e0888d.fa28af",
        "type": "tab",
        "label": "AWS IoT",
        "disabled": false,
        "info": ""
    },
    {
        "id": "4db33b14.0c14dc",
        "type": "tab",
        "label": "AWS Shadow",
        "disabled": false,
        "info": ""
    },
    {
        "id": "6bd10abf.a890a4",
        "type": "tls-config",
        "z": "",
        "name": "AWS-mbNET",
        "cert": "",
        "key": "",
        "ca": "",
        "certname": "d0377249f5-certificate.pem",
        "keyname": "d0377249f5-private.pem.key",
        "caname": "root_CA.pem",
        "servername": "",
        "verifyservercert": true
    },
    {
        "id": "cb263fb5.685cc",
        "type": "mqtt-broker",
        "z": "",
        "name": "AWS-IoT",
        "broker": "al9sdn8b1thyf-ats.iot.us-west-2.amazonaws.com",
        "port": "8883",
        "tls": "6bd10abf.a890a4",
        "clientid": "mbNET",
        "usetls": true,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": false,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "da7707e0.7f97",
        "type": "ui_base",
        "theme": {
            "name": "theme-light",
            "lightTheme": {
                "default": "#0094CE",
                "baseColor": "#0094CE",
                "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
                "edited": true,
                "reset": false
            },
            "darkTheme": {
                "default": "#097479",
                "baseColor": "#097479",
                "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
                "edited": false
            },
            "customTheme": {
                "name": "Untitled Theme 1",
                "default": "#4B7930",
                "baseColor": "#4B7930",
                "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
            },
            "themeState": {
                "base-color": {
                    "default": "#0094CE",
                    "value": "#0094CE",
                    "edited": false
                },
                "page-titlebar-backgroundColor": {
                    "value": "#0094CE",
                    "edited": false
                },
                "page-backgroundColor": {
                    "value": "#fafafa",
                    "edited": false
                },
                "page-sidebar-backgroundColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "group-textColor": {
                    "value": "#1bbfff",
                    "edited": false
                },
                "group-borderColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "group-backgroundColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "widget-textColor": {
                    "value": "#111111",
                    "edited": false
                },
                "widget-backgroundColor": {
                    "value": "#0094ce",
                    "edited": false
                },
                "widget-borderColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "base-font": {
                    "value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
                }
            },
            "angularTheme": {
                "primary": "indigo",
                "accents": "blue",
                "warn": "red",
                "background": "grey"
            }
        },
        "site": {
            "name": "Node-RED Dashboard",
            "hideToolbar": "false",
            "allowSwipe": "false",
            "lockMenu": "false",
            "allowTempTheme": "true",
            "dateFormat": "DD/MM/YYYY",
            "sizes": {
                "sx": 48,
                "sy": 48,
                "gx": 6,
                "gy": 6,
                "cx": 6,
                "cy": 6,
                "px": 0,
                "py": 0
            }
        }
    },
    {
        "id": "62bc435e.bc20cc",
        "type": "cloud endpoint",
        "z": "",
        "devtype": "RKH259",
        "name": "",
        "cycle": 15000,
        "vartable": [
            {
                "tag": "GSM_PROVIDER",
                "id": "1322",
                "datatype": ""
            },
            {
                "tag": "GSM_ERROR",
                "id": "1321",
                "datatype": ""
            },
            {
                "tag": "GSM_LEVEL",
                "id": "1320",
                "datatype": ""
            },
            {
                "tag": "GSM_STATE",
                "id": "1319",
                "datatype": ""
            },
            {
                "tag": "CYCLETIME",
                "id": "1318",
                "datatype": ""
            },
            {
                "tag": "FC4",
                "id": "1317",
                "datatype": ""
            },
            {
                "tag": "FC3",
                "id": "1316",
                "datatype": ""
            },
            {
                "tag": "FC2",
                "id": "1315",
                "datatype": ""
            },
            {
                "tag": "FC1",
                "id": "1314",
                "datatype": ""
            },
            {
                "tag": "DOUT2",
                "id": "1313",
                "datatype": ""
            },
            {
                "tag": "DOUT1",
                "id": "1312",
                "datatype": ""
            },
            {
                "tag": "LOG_ERROR",
                "id": "1311",
                "datatype": ""
            },
            {
                "tag": "SCRIPTVERSION",
                "id": "1310",
                "datatype": ""
            },
            {
                "tag": "DIN4",
                "id": "1309",
                "datatype": ""
            },
            {
                "tag": "DIN3",
                "id": "1308",
                "datatype": ""
            },
            {
                "tag": "DIN2",
                "id": "1307",
                "datatype": ""
            },
            {
                "tag": "DIN1",
                "id": "1306",
                "datatype": ""
            },
            {
                "tag": "LAN_STATE",
                "id": "1305",
                "datatype": ""
            },
            {
                "tag": "WAN_STATE",
                "id": "1304",
                "datatype": ""
            },
            {
                "tag": "USB_STATE",
                "id": "1303",
                "datatype": ""
            },
            {
                "tag": "DEVICETIME",
                "id": "1302",
                "datatype": ""
            },
            {
                "tag": "GSM_NETWORK",
                "id": "1323",
                "datatype": ""
            },
            {
                "tag": "Var1",
                "id": "1419",
                "datatype": ""
            },
            {
                "tag": "Var2",
                "id": "1420",
                "datatype": ""
            },
            {
                "tag": "Var3",
                "id": "1421",
                "datatype": ""
            },
            {
                "tag": "Var4",
                "id": "1422",
                "datatype": ""
            },
            {
                "tag": "Var5",
                "id": "1423",
                "datatype": ""
            },
            {
                "tag": "Var6",
                "id": "1424",
                "datatype": ""
            },
            {
                "tag": "Var7",
                "id": "1425",
                "datatype": ""
            },
            {
                "tag": "Var8",
                "id": "1426",
                "datatype": ""
            },
            {
                "tag": "Var9",
                "id": "1427",
                "datatype": ""
            },
            {
                "tag": "Var10",
                "id": "1428",
                "datatype": ""
            },
            {
                "tag": "Var11",
                "id": "1429",
                "datatype": ""
            },
            {
                "tag": "Var12",
                "id": "1430",
                "datatype": ""
            },
            {
                "tag": "Var13",
                "id": "1431",
                "datatype": ""
            },
            {
                "tag": "Var14",
                "id": "1432",
                "datatype": ""
            },
            {
                "tag": "Var15",
                "id": "1433",
                "datatype": ""
            },
            {
                "tag": "Var16",
                "id": "1434",
                "datatype": ""
            },
            {
                "tag": "Var17",
                "id": "1435",
                "datatype": ""
            },
            {
                "tag": "Var18",
                "id": "1436",
                "datatype": ""
            },
            {
                "tag": "Var19",
                "id": "1437",
                "datatype": ""
            },
            {
                "tag": "Var20",
                "id": "1438",
                "datatype": ""
            }
        ]
    },
    {
        "id": "4ec78dd0.236e6c",
        "type": "inject",
        "z": "13e0888d.fa28af",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 120,
        "y": 80,
        "wires": [
            [
                "ded0d406.7d944"
            ]
        ]
    },
    {
        "id": "ded0d406.7d944",
        "type": "mqtt out",
        "z": "13e0888d.fa28af",
        "name": "",
        "topic": "mymbNETTopic",
        "qos": "1",
        "retain": "",
        "broker": "cb263fb5.685cc",
        "x": 480,
        "y": 80,
        "wires": []
    },
    {
        "id": "cf82dfff.4cf24",
        "type": "mqtt in",
        "z": "4db33b14.0c14dc",
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update/delta",
        "qos": "1",
        "datatype": "utf8",
        "broker": "cb263fb5.685cc",
        "x": 180,
        "y": 120,
        "wires": [
            [
                "7e3ed592.fe4514",
                "ed4d2fcd.aa8118",
                "2954839e.4976bc"
            ]
        ]
    },
    {
        "id": "f9ee1e7f.b40698",
        "type": "device out",
        "z": "4db33b14.0c14dc",
        "option": "fwversion",
        "receiver": "",
        "text": "",
        "emailsubject": "",
        "x": 350,
        "y": 540,
        "wires": [
            [
                "1b2d86d2.db4e09"
            ]
        ]
    },
    {
        "id": "3d032a28.6aaa26",
        "type": "cloud out",
        "z": "4db33b14.0c14dc",
        "devtypeout": "RKH259",
        "endpoint": "62bc435e.bc20cc",
        "variable": "",
        "varid": "1316",
        "vardatatype": "",
        "writevalue": "",
        "name": "",
        "x": 790,
        "y": 320,
        "wires": [
            [
                "1b2d86d2.db4e09",
                "2954839e.4976bc"
            ]
        ]
    },
    {
        "id": "84010696.105e68",
        "type": "mqtt out",
        "z": "4db33b14.0c14dc",
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update",
        "qos": "1",
        "retain": "",
        "broker": "cb263fb5.685cc",
        "x": 1190,
        "y": 480,
        "wires": []
    },
    {
        "id": "1b2d86d2.db4e09",
        "type": "switch",
        "z": "4db33b14.0c14dc",
        "name": "",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "DOUT1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "DOUT2",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "DIN1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "DIN2",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "DIN3",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "DIN4",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "fwversion",
                "vt": "str"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 7,
        "x": 570,
        "y": 540,
        "wires": [
            [
                "e10766e5.6820a"
            ],
            [
                "eb642a8.b87c6d8"
            ],
            [
                "6db886d6.eb005"
            ],
            [
                "315c316c.393e4e"
            ],
            [
                "f6c28b89.e776d"
            ],
            [
                "1fc7a239.84b4ae"
            ],
            [
                "606e0f50.34cc1"
            ]
        ]
    },
    {
        "id": "eb642a8.b87c6d8",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state DOUT2",
        "func": "var state = \"low\";\nvar data={\"state\":{\"reported\":{\"DOUT2\":\"low\"}}};\nif (msg.payload == \"1\") {\n    state = \"high\";\n}\ndata.state.reported.DOUT2 = state;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 800,
        "y": 520,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "6db886d6.eb005",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state DIN1",
        "func": "var state = \"low\";\nvar data={\"state\":{\"reported\":{\"DIN1\":\"low\"}}};\nif (msg.payload == \"1\") {\n    state = \"high\";\n}\ndata.state.reported.DIN1 = state;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 790,
        "y": 560,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "315c316c.393e4e",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state DIN2",
        "func": "var state = \"low\";\nvar data={\"state\":{\"reported\":{\"DIN2\":\"low\"}}};\nif (msg.payload == \"1\") {\n    state = \"high\";\n}\ndata.state.reported.DIN2 = state;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 790,
        "y": 600,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "f6c28b89.e776d",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state DIN3",
        "func": "var state = \"low\";\nvar data={\"state\":{\"reported\":{\"DIN3\":\"low\"}}};\nif (msg.payload == \"1\") {\n    state = \"high\";\n}\ndata.state.reported.DIN3 = state;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 790,
        "y": 640,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "1fc7a239.84b4ae",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state DIN4",
        "func": "var state = \"low\";\nvar data={\"state\":{\"reported\":{\"DIN4\":\"low\"}}};\nif (msg.payload == \"1\") {\n    state = \"high\";\n}\ndata.state.reported.DIN4 = state;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 790,
        "y": 680,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "e10766e5.6820a",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state DOUT1",
        "func": "var state = \"low\";\nvar data={\"state\":{\"reported\":{\"DOUT1\":\"low\"}}};\nif (msg.payload == \"1\") {\n    state = \"high\";\n}\ndata.state.reported.DOUT1 = state;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 800,
        "y": 480,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "606e0f50.34cc1",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "report state Firmwareversion",
        "func": "var data={\"state\":{\"reported\":{\"Firmwareversion\":\"0\"}}};\ndata.state.reported.Firmwareversion = msg.payload;\nmsg.payload = JSON.stringify(data);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 820,
        "y": 720,
        "wires": [
            [
                "84010696.105e68"
            ]
        ]
    },
    {
        "id": "cbe5b78b.a930b8",
        "type": "status",
        "z": "4db33b14.0c14dc",
        "name": "",
        "scope": [
            "84010696.105e68"
        ],
        "x": 100,
        "y": 440,
        "wires": [
            [
                "81faa81f.0da068"
            ]
        ]
    },
    {
        "id": "81faa81f.0da068",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "AWS connected",
        "func": "if (msg.status.text == \"node-red:common.status.connected\") {\n    msg.payload = \"\";\n    msg.topic = \"fwversion\";\n    return msg;\n}\n",
        "outputs": 1,
        "noerr": 0,
        "x": 320,
        "y": 440,
        "wires": [
            [
                "f9ee1e7f.b40698"
            ]
        ]
    },
    {
        "id": "7e3ed592.fe4514",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "Select from DOUT1",
        "func": "p=JSON.parse(msg.payload);\nmsg.topic = \"DOUT1\";\nif (p.state.DOUT1 == \"low\") {\n    msg.payload = \"0\";\n} else {\n    msg.payload = \"1\";\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 750,
        "y": 120,
        "wires": [
            [
                "3d032a28.6aaa26"
            ]
        ]
    },
    {
        "id": "ed4d2fcd.aa8118",
        "type": "function",
        "z": "4db33b14.0c14dc",
        "name": "Select from DOUT2",
        "func": "p=JSON.parse(msg.payload);\nmsg.topic = \"DOUT2\";\nif (p.state.DOUT2 == \"low\") {\n    msg.payload = \"0\";\n} else {\n    msg.payload = \"1\";\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 750,
        "y": 160,
        "wires": [
            [
                "3d032a28.6aaa26"
            ]
        ]
    },
    {
        "id": "1710304b.fbbb8",
        "type": "comment",
        "z": "4db33b14.0c14dc",
        "name": "Read Firmwareversion when AWS MQTT has connected",
        "info": "",
        "x": 240,
        "y": 340,
        "wires": []
    },
    {
        "id": "9fe40930.22d13",
        "type": "comment",
        "z": "4db33b14.0c14dc",
        "name": "Read updates from AWS MQTT channel",
        "info": "",
        "x": 180,
        "y": 80,
        "wires": []
    },
    {
        "id": "a30baa1d.aac6b8",
        "type": "comment",
        "z": "4db33b14.0c14dc",
        "name": "Write updates to AWS MQTT channel",
        "info": "",
        "x": 1190,
        "y": 440,
        "wires": []
    },
    {
        "id": "9dab5c9c.177dc",
        "type": "comment",
        "z": "4db33b14.0c14dc",
        "name": "Hanlding AWS thing Shadow",
        "info": "",
        "x": 140,
        "y": 40,
        "wires": []
    },
    {
        "id": "2954839e.4976bc",
        "type": "debug",
        "z": "4db33b14.0c14dc",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 950,
        "y": 260,
        "wires": []
    },
    {
        "id": "abadeabd.186ea8",
        "type": "debug",
        "z": "13e0888d.fa28af",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 440,
        "y": 200,
        "wires": []
    },
    {
        "id": "9879e111.122e8",
        "type": "mqtt in",
        "z": "13e0888d.fa28af",
        "name": "",
        "topic": "mymbNETTopic",
        "qos": "0",
        "datatype": "auto",
        "broker": "cb263fb5.685cc",
        "x": 140,
        "y": 200,
        "wires": [
            [
                "abadeabd.186ea8"
            ]
        ]
    },
    {
        "id": "681f2b2a.ee9534",
        "type": "mqtt in",
        "z": "4db33b14.0c14dc",
        "d": true,
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update/get/accepted",
        "qos": "1",
        "datatype": "utf8",
        "broker": "cb263fb5.685cc",
        "x": 240,
        "y": 820,
        "wires": [
            [
                "ef702171.d0dd48"
            ]
        ]
    },
    {
        "id": "ef702171.d0dd48",
        "type": "debug",
        "z": "4db33b14.0c14dc",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 690,
        "y": 820,
        "wires": []
    },
    {
        "id": "b381e58.c683318",
        "type": "mqtt in",
        "z": "4db33b14.0c14dc",
        "d": true,
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update/get/rejected",
        "qos": "1",
        "datatype": "utf8",
        "broker": "cb263fb5.685cc",
        "x": 240,
        "y": 860,
        "wires": [
            [
                "ef702171.d0dd48"
            ]
        ]
    },
    {
        "id": "8ded63dc.06ecf",
        "type": "mqtt in",
        "z": "4db33b14.0c14dc",
        "d": true,
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update/documents",
        "qos": "1",
        "datatype": "utf8",
        "broker": "cb263fb5.685cc",
        "x": 240,
        "y": 900,
        "wires": [
            [
                "ef702171.d0dd48"
            ]
        ]
    },
    {
        "id": "147da9e2.13068e",
        "type": "mqtt in",
        "z": "4db33b14.0c14dc",
        "d": true,
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update/accepted",
        "qos": "1",
        "datatype": "utf8",
        "broker": "cb263fb5.685cc",
        "x": 230,
        "y": 940,
        "wires": [
            [
                "ef702171.d0dd48"
            ]
        ]
    },
    {
        "id": "9ac44672.5ffbc",
        "type": "mqtt in",
        "z": "4db33b14.0c14dc",
        "d": true,
        "name": "",
        "topic": "$aws/things/mbNET/shadow/update/rejected",
        "qos": "1",
        "datatype": "utf8",
        "broker": "cb263fb5.685cc",
        "x": 230,
        "y": 980,
        "wires": [
            [
                "ef702171.d0dd48"
            ]
        ]
    }
]