[
    {
        "id": "dc4105accbc11653",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "function 1",
        "func": "let slave_id  = global.get(\"slave_id\").toString();\nlet baudrate  = global.get(\"baudrate\").toString();\nlet serconfig = global.get(\"serconfig\");\nlet address   = global.get(\"address\").toString();\nlet regvalue  = global.get(\"regvalue\").toString();\nlet coilvalue = global.get(\"coilvalue\").toString();\nlet quantity  = global.get(\"quantity\").toString();\n\nlet fc = msg.payload;\n\nlet aux = slave_id.concat(\" \", baudrate);\naux = aux.concat(\" \", serconfig);\naux = aux.concat(\" \", fc);\naux = aux.concat(\" \", address);\n\nif (fc == 0x01 || fc == 0x02 || fc == 0x03 || fc == 0x04) {\n    aux = aux.concat(\" \", quantity);    \n} else if (fc == 0x05){\n    aux = aux.concat(\" \", coilvalue);\n} else if (fc == 0x06){\n    aux = aux.concat(\" \", regvalue);\n} else {\n    aux = aux.concat(\" \", 0);\n}\n\nmsg.payload = aux;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 360,
        "wires": [
            [
                "3abd3d3b79ddb369"
            ]
        ]
    },
    {
        "id": "3abd3d3b79ddb369",
        "type": "exec",
        "z": "94325b4d18f93d36",
        "command": "/home/pi/modbusrtu/main",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 790,
        "y": 360,
        "wires": [
            [
                "bcb00dafc19ac4b5"
            ],
            [
                "f367f7c6c848ea71"
            ],
            []
        ]
    },
    {
        "id": "84aed2e599c09545",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Slave ID",
        "func": "global.set(\"slave_id\", msg.payload.toString());\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"slave_id\", 31);\n",
        "finalize": "",
        "libs": [],
        "x": 790,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "b0843a8a8d478419",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Baudrate",
        "func": "global.set(\"baudrate\", msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"baudrate\", 38400);\n",
        "finalize": "",
        "libs": [],
        "x": 790,
        "y": 500,
        "wires": [
            []
        ]
    },
    {
        "id": "e8893898bc0add74",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Address",
        "func": "global.set(\"address\", msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"address\", 0);",
        "finalize": "",
        "libs": [],
        "x": 790,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "761c22b6d9e74864",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Register Value",
        "func": "global.set(\"regvalue\", msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"regvalue\", 0);\n",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 640,
        "wires": [
            []
        ]
    },
    {
        "id": "56c391980e76a1f6",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Quantity",
        "func": "global.set(\"quantity\", msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"quantity\", 1);\n",
        "finalize": "",
        "libs": [],
        "x": 790,
        "y": 720,
        "wires": [
            []
        ]
    },
    {
        "id": "ad3876d6713f8d60",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Coil Value",
        "func": "global.set(\"coilvalue\", msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"coilvalue\", 0);\n",
        "finalize": "",
        "libs": [],
        "x": 800,
        "y": 680,
        "wires": [
            []
        ]
    },
    {
        "id": "9961386291b5600c",
        "type": "ui_button",
        "z": "94325b4d18f93d36",
        "name": "",
        "group": "583263d284c59c95",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Write Single Coil",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "5",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 360,
        "y": 360,
        "wires": [
            [
                "dc4105accbc11653"
            ]
        ]
    },
    {
        "id": "f021dbeeb7e38ded",
        "type": "ui_button",
        "z": "94325b4d18f93d36",
        "name": "",
        "group": "583263d284c59c95",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Write Single Register",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "6",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 340,
        "y": 400,
        "wires": [
            [
                "dc4105accbc11653"
            ]
        ]
    },
    {
        "id": "7349cb4d8044f227",
        "type": "ui_button",
        "z": "94325b4d18f93d36",
        "name": "",
        "group": "583263d284c59c95",
        "order": 5,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Read Coils",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "1",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 370,
        "y": 440,
        "wires": [
            [
                "dc4105accbc11653"
            ]
        ]
    },
    {
        "id": "0f0f2466f6ec97b3",
        "type": "ui_button",
        "z": "94325b4d18f93d36",
        "name": "",
        "group": "583263d284c59c95",
        "order": 6,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Read Holding Registers",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "3",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 330,
        "y": 480,
        "wires": [
            [
                "dc4105accbc11653"
            ]
        ]
    },
    {
        "id": "1112b409775a5178",
        "type": "ui_button",
        "z": "94325b4d18f93d36",
        "name": "",
        "group": "583263d284c59c95",
        "order": 7,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Read Discrete Inputs",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "2",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 340,
        "y": 520,
        "wires": [
            [
                "dc4105accbc11653"
            ]
        ]
    },
    {
        "id": "9ce00a590f17a04d",
        "type": "ui_button",
        "z": "94325b4d18f93d36",
        "name": "",
        "group": "583263d284c59c95",
        "order": 8,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Read Input Registers",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "4",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 340,
        "y": 560,
        "wires": [
            [
                "dc4105accbc11653"
            ]
        ]
    },
    {
        "id": "354c446baa2f0c96",
        "type": "ui_dropdown",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Baudrate",
        "tooltip": "",
        "place": "Select option",
        "group": "d49ab80870c92741",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "9600",
                "value": "9600",
                "type": "str"
            },
            {
                "label": "19200",
                "value": "19200",
                "type": "str"
            },
            {
                "label": "38400",
                "value": "38400",
                "type": "str"
            },
            {
                "label": "57600",
                "value": "57600",
                "type": "str"
            },
            {
                "label": "115200",
                "value": "115200",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 620,
        "y": 500,
        "wires": [
            [
                "b0843a8a8d478419"
            ]
        ]
    },
    {
        "id": "1004e4744f6d4dbe",
        "type": "ui_switch",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Set Coil",
        "tooltip": "",
        "group": "583263d284c59c95",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "1",
        "onvalueType": "num",
        "onicon": "",
        "oncolor": "",
        "offvalue": "0",
        "offvalueType": "num",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 620,
        "y": 680,
        "wires": [
            [
                "ad3876d6713f8d60"
            ]
        ]
    },
    {
        "id": "acf7bae2d25d305e",
        "type": "ui_slider",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Slave ID",
        "tooltip": "",
        "group": "d49ab80870c92741",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "topic",
        "topicType": "msg",
        "min": 0,
        "max": "31",
        "step": 1,
        "className": "",
        "x": 620,
        "y": 460,
        "wires": [
            [
                "84aed2e599c09545"
            ]
        ]
    },
    {
        "id": "b69e50198eb2eb5e",
        "type": "ui_numeric",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Starting Address",
        "tooltip": "",
        "group": "d49ab80870c92741",
        "order": 5,
        "width": 0,
        "height": 0,
        "wrap": false,
        "passthru": true,
        "topic": "topic",
        "topicType": "msg",
        "format": "{{value}}",
        "min": 0,
        "max": 10,
        "step": 1,
        "className": "",
        "x": 600,
        "y": 580,
        "wires": [
            [
                "e8893898bc0add74"
            ]
        ]
    },
    {
        "id": "270aa46273413ea4",
        "type": "ui_numeric",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Quantity",
        "tooltip": "",
        "group": "d49ab80870c92741",
        "order": 2,
        "width": 0,
        "height": 0,
        "wrap": false,
        "passthru": true,
        "topic": "topic",
        "topicType": "msg",
        "format": "{{value}}",
        "min": 0,
        "max": 10,
        "step": 1,
        "className": "",
        "x": 620,
        "y": 720,
        "wires": [
            [
                "56c391980e76a1f6"
            ]
        ]
    },
    {
        "id": "4fe99fdf18a818c3",
        "type": "ui_text_input",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Register Value",
        "tooltip": "",
        "group": "583263d284c59c95",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "topic",
        "sendOnBlur": true,
        "className": "",
        "topicType": "msg",
        "x": 600,
        "y": 640,
        "wires": [
            [
                "761c22b6d9e74864"
            ]
        ]
    },
    {
        "id": "bcb00dafc19ac4b5",
        "type": "ui_text",
        "z": "94325b4d18f93d36",
        "group": "d49ab80870c92741",
        "order": 7,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Read",
        "format": "{{msg.payload.slice(0, -2)}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 990,
        "y": 320,
        "wires": []
    },
    {
        "id": "f367f7c6c848ea71",
        "type": "ui_toast",
        "z": "94325b4d18f93d36",
        "position": "dialog",
        "displayTime": "3",
        "highlight": "",
        "sendall": false,
        "outputs": 1,
        "ok": "Check parameters and connections",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "",
        "name": "",
        "x": 1010,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "8169fa8c10cba575",
        "type": "function",
        "z": "94325b4d18f93d36",
        "name": "Set Serial Config",
        "func": "global.set(\"serconfig\", msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nglobal.set(\"serconfig\", \"8N1\");\n",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "8771164ec909f7e0",
        "type": "ui_dropdown",
        "z": "94325b4d18f93d36",
        "name": "",
        "label": "Serial Config",
        "tooltip": "",
        "place": "Select option",
        "group": "d49ab80870c92741",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "8N1",
                "value": "8N1",
                "type": "str"
            },
            {
                "label": "8N2",
                "value": "8N2",
                "type": "str"
            },
            {
                "label": "8E1",
                "value": "8E1",
                "type": "str"
            },
            {
                "label": "8E2",
                "value": "8E2",
                "type": "str"
            },
            {
                "label": "8O1",
                "value": "8O1",
                "type": "str"
            },
            {
                "label": "8O2",
                "value": "8O2",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 610,
        "y": 540,
        "wires": [
            [
                "8169fa8c10cba575"
            ]
        ]
    },
    {
        "id": "583263d284c59c95",
        "type": "ui_group",
        "name": "Request",
        "tab": "2b460dbfa87b19b6",
        "order": 3,
        "disp": true,
        "width": 6,
        "collapse": false,
        "className": ""
    },
    {
        "id": "d49ab80870c92741",
        "type": "ui_group",
        "name": "Set Parameters",
        "tab": "2b460dbfa87b19b6",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "2b460dbfa87b19b6",
        "type": "ui_tab",
        "name": "Modbus RTU",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]