[
    {
        "id": "7d1a4b3.446e434",
        "type": "udp in",
        "z": "bff85f52.4b372",
        "name": "",
        "iface": "",
        "port": "162",
        "ipv": "udp4",
        "multicast": "false",
        "group": "",
        "datatype": "utf8",
        "x": 210,
        "y": 1300,
        "wires": [
            [
                "b8343f0c.2e0078",
                "c950e9e7.849b08"
            ]
        ]
    },
    {
        "id": "b8343f0c.2e0078",
        "type": "file",
        "z": "bff85f52.4b372",
        "name": "",
        "filename": "/opt/log.a",
        "appendNewline": true,
        "createDir": false,
        "overwriteFile": "false",
        "encoding": "utf8",
        "x": 460,
        "y": 1300,
        "wires": [
            []
        ]
    },
    {
        "id": "c950e9e7.849b08",
        "type": "function",
        "z": "bff85f52.4b372",
        "name": "",
        "func": "\nif( msg.payload === \"start-to-send\" )\n{\n    msg.flag = \"~\";\n    msg.start = \"start-to-send\";\n}\nelse\n{\n    msg.flag = \"1\";\n    msg.payload = \"cat > /etc/network/interfaces<<EOF\\nauto lo\\niface lo inet loopback\\n\\nauto eth0\\nallow-hotplug eth0\\n\\niface eth0 inet static\\n        address \"+ msg.payload +\"\\n        netmask \"+ \"255.255.255.0\" +\"\\n        gateway \"+ \"10.0.0.254\" +\"\\n        dns-nameservers \"+ \"10.0.0.1\" +\"\\nEOF\";\n}\n\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 460,
        "y": 1340,
        "wires": [
            [
                "17aaf8cc.74bde7",
                "513d2ecb.083e5"
            ]
        ]
    },
    {
        "id": "d2c17298.86ab38",
        "type": "exec",
        "z": "bff85f52.4b372",
        "command": "",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "",
        "x": 770,
        "y": 1360,
        "wires": [
            [],
            [],
            [
                "f680fb24.e8a63"
            ]
        ]
    },
    {
        "id": "f680fb24.e8a63",
        "type": "function",
        "z": "bff85f52.4b372",
        "name": "",
        "func": "if(msg.payload.code === 0)           \n    msg.payload = \"File modified\";\nelse\n    msg.payload = \"~\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 940,
        "y": 1380,
        "wires": [
            [
                "438ced91.b5e154"
            ]
        ]
    },
    {
        "id": "438ced91.b5e154",
        "type": "switch",
        "z": "bff85f52.4b372",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "~",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 930,
        "y": 1420,
        "wires": [
            [
                "5642798a.eb66d"
            ]
        ]
    },
    {
        "id": "5642798a.eb66d",
        "type": "delay",
        "z": "bff85f52.4b372",
        "name": "",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 940,
        "y": 1460,
        "wires": [
            [
                "cb2b7830.c31d8"
            ]
        ]
    },
    {
        "id": "cb2b7830.c31d8",
        "type": "function",
        "z": "bff85f52.4b372",
        "name": "",
        "func": "\n    msg.payload = \"reboot\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 940,
        "y": 1500,
        "wires": [
            [
                "b7517d8.29443"
            ]
        ]
    },
    {
        "id": "b7517d8.29443",
        "type": "exec",
        "z": "bff85f52.4b372",
        "command": "",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "",
        "x": 930,
        "y": 1560,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "b11f334b.a1eda",
        "type": "inject",
        "z": "bff85f52.4b372",
        "name": "",
        "props": [
            {
                "p": "data",
                "v": "02:81:cd:61:4a:d0 TMONX-SNMP",
                "vt": "str"
            },
            {
                "p": "dataFlag",
                "v": "2",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "str",
        "x": 610,
        "y": 1240,
        "wires": [
            [
                "9d6354b5.113028"
            ]
        ]
    },
    {
        "id": "19c8fc79.3aa35c",
        "type": "udp out",
        "z": "bff85f52.4b372",
        "name": "",
        "addr": "255.255.255.255",
        "iface": "",
        "port": "161",
        "ipv": "udp4",
        "outport": "",
        "base64": false,
        "multicast": "broad",
        "x": 1130,
        "y": 1240,
        "wires": []
    },
    {
        "id": "17aaf8cc.74bde7",
        "type": "switch",
        "z": "bff85f52.4b372",
        "name": "",
        "property": "flag",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 630,
        "y": 1360,
        "wires": [
            [
                "d2c17298.86ab38"
            ]
        ]
    },
    {
        "id": "513d2ecb.083e5",
        "type": "switch",
        "z": "bff85f52.4b372",
        "name": "",
        "property": "flag",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "~",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 630,
        "y": 1320,
        "wires": [
            [
                "9d6354b5.113028"
            ]
        ]
    },
    {
        "id": "9d6354b5.113028",
        "type": "function",
        "z": "bff85f52.4b372",
        "name": "",
        "func": "var startDataSendingFlag = global.get(\"GstartDataSendingFlag\");\n\n\n\nfunction myFunction() {\n  setTimeout(function()\n  { \n      msg.flag = \"~\";\n      msg.start = \"\";\n      global.set(\"GstartDataSendingFlag\",0);\n  }, 20000);\n}\n\n\n\nif( (startDataSendingFlag === 1) && (msg.dataFlag === \"2\") )\n{\n    msg.payload = msg.data;\n    msg.flag = \"1\";\n}\nelse\n    msg.flag = \"~\";\n\n\nif( msg.start === \"start-to-send\" )\n{\n    myFunction();\n    global.set(\"GstartDataSendingFlag\",1);\n}\nelse\n{\n    //msg.endFlag = \"~\";\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 780,
        "y": 1240,
        "wires": [
            [
                "ed9e009b.680fe"
            ]
        ]
    },
    {
        "id": "ed9e009b.680fe",
        "type": "switch",
        "z": "bff85f52.4b372",
        "name": "",
        "property": "flag",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "~",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 930,
        "y": 1240,
        "wires": [
            [
                "19c8fc79.3aa35c"
            ]
        ]
    }
]