[
    {
        "id": "cfae12731057c553",
        "type": "tab",
        "label": "MODBUS_TCP_SLAVE",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "2857a0031c45b08a",
        "type": "group",
        "z": "cfae12731057c553",
        "name": "CONTROL",
        "style": {
            "stroke": "#000000",
            "fill": "#bfdbef",
            "label": true,
            "color": "#000000",
            "label-position": "n"
        },
        "nodes": [
            "d388e85f2fe1b27f",
            "3248205cc2c9a929",
            "4b2f2756de30a0b0",
            "73e06c069369b560",
            "ab940c74db66bee1",
            "83e9887bf1d9926b",
            "fdd6e6e80eff0d3c",
            "99088db4f7401535",
            "6b12fafcb26841d2",
            "dbe719e96fa66ed5"
        ],
        "x": 794,
        "y": 79,
        "w": 652,
        "h": 322
    },
    {
        "id": "7c4e39d1729d6570",
        "type": "group",
        "z": "cfae12731057c553",
        "name": "INPUTS",
        "style": {
            "stroke": "#000000",
            "label": true,
            "color": "#000000",
            "fill": "#e3f3d3"
        },
        "nodes": [
            "81ca1264f54fc252",
            "500c1ce7ad4c9dcc",
            "7649d68fc7e0a399",
            "57108bc05b3d00cb",
            "23502c88421a88cf",
            "24430309ee419f39",
            "2343e22235c97f26",
            "905d0fc69ad7a934",
            "d0861668c327fb5c",
            "07100da0cad0b41f",
            "e5c452de983324e2",
            "f6ec31236d48ae6e",
            "fe8d3f7d3c96684d",
            "e7160b3caa235341",
            "3a058c50c53a544b",
            "47ef536b9d86f9fe",
            "20d0b6a3a2e61c6a",
            "224c68b588b4b2c6",
            "f36976de5e56ed6d",
            "2a9b6d53c769aaaf",
            "51926e6a67f34716",
            "cd6051dca0c2e330",
            "9044d20129e62e54",
            "dac62bb90b6d6ee5",
            "97169286d4553246",
            "af55f2c0ee32b627",
            "8f867cf458a43d6c",
            "3b0a9e706f8aeb7f",
            "4b5246fc6ad2d3e8",
            "319434f75d7b950b",
            "3da80d769e2bb631"
        ],
        "x": 34,
        "y": 79,
        "w": 752,
        "h": 582
    },
    {
        "id": "2fc8282c5c588387",
        "type": "group",
        "z": "cfae12731057c553",
        "name": "OUPUTS",
        "style": {
            "stroke": "#000000",
            "fill": "#ffbfbf",
            "label": true,
            "color": "#000000",
            "label-position": "ne"
        },
        "nodes": [
            "585d00d8e9c883c5",
            "0c32e8a40efd7b65",
            "a99bbc7d8ffa4db9",
            "460f8e82d4fdb890",
            "c25ef1822cb5184d",
            "715dcb755eca1d99",
            "d614fe7be9f57c6b",
            "59396664d736a82d",
            "dcf640263f170103",
            "ca913802a2c75bd5",
            "497cb3d1b4448af5",
            "f9ed148ee00d0d97",
            "b9131811d9df1407",
            "108ede58e2d061e3",
            "39e35f6c254a0369"
        ],
        "x": 1454,
        "y": 79,
        "w": 532,
        "h": 522
    },
    {
        "id": "d388e85f2fe1b27f",
        "type": "debug",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "coils buffer",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1330,
        "y": 220,
        "wires": []
    },
    {
        "id": "3248205cc2c9a929",
        "type": "debug",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "holding buffer",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1320,
        "y": 120,
        "wires": []
    },
    {
        "id": "4b2f2756de30a0b0",
        "type": "debug",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "input buffer",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1330,
        "y": 320,
        "wires": []
    },
    {
        "id": "73e06c069369b560",
        "type": "debug",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "discrete inputs buffer",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1300,
        "y": 360,
        "wires": []
    },
    {
        "id": "83e9887bf1d9926b",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "frameCoilIN",
        "func": "msg.payload = { 'value': msg.payload, 'register': 'discrete', 'address': 0, 'disableMsgOutput': 0 };\nreturn msg;\n\n// msg.payload = { \n//     'value': msg.payload, \n//     'register': 'discrete', \n//     'address': 0 ,\n//     'disablemsg' : 1\n// } ;\n// return msg",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 890,
        "y": 240,
        "wires": [
            [
                "99088db4f7401535"
            ]
        ]
    },
    {
        "id": "fdd6e6e80eff0d3c",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "frameRegIN",
        "func": "msg.payload = { 'value': msg.payload, 'register': 'input', 'address': 0, 'quantity': 2, 'disableMsgOutput': 0 };\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 890,
        "y": 320,
        "wires": [
            [
                "99088db4f7401535"
            ]
        ]
    },
    {
        "id": "6cfe398e8b563e1f",
        "type": "comment",
        "z": "cfae12731057c553",
        "name": "Modbus TCP slave (server) example for RPI PLC 21 ",
        "info": "",
        "x": 230,
        "y": 40,
        "wires": []
    },
    {
        "id": "6b12fafcb26841d2",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "getRegOUT",
        "func": "function convertirPayload(payload) {\n    // Inicializar un array vacío para almacenar los valores convertidos\n    let valoresConvertidos = [];\n\n    // Iterar sobre el payload de dos en dos, ya que cada par representa un valor en hexadecimal\n    for (let i = 0; i < payload.length; i += 2) {\n        // Calcular el valor decimal correspondiente al par de valores hexadecimales\n        let valorDecimal = payload[i] * 256 + payload[i + 1];\n\n        // Agregar el valor decimal al array de valores convertidos\n        valoresConvertidos.push(valorDecimal);\n    }\n\n    // Retornar el array con los valores convertidos\n    return valoresConvertidos;\n}\n\nlet nuevoPayload = convertirPayload(msg.payload);\nmsg.payload = nuevoPayload\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1330,
        "y": 160,
        "wires": [
            [
                "c25ef1822cb5184d"
            ]
        ]
    },
    {
        "id": "585d00d8e9c883c5",
        "type": "switch",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "name": "",
        "property": "parts.index",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 1650,
        "y": 160,
        "wires": [
            [
                "0c32e8a40efd7b65"
            ],
            [
                "a99bbc7d8ffa4db9"
            ],
            [
                "460f8e82d4fdb890"
            ]
        ]
    },
    {
        "id": "c25ef1822cb5184d",
        "type": "split",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": "1",
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 1530,
        "y": 160,
        "wires": [
            [
                "585d00d8e9c883c5"
            ]
        ]
    },
    {
        "id": "81ca1264f54fc252",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "valueBitArray",
        "func": "function multiplicarPorPotenciaDeDos(lista) {\n    let resultado = 0;\n    for (let i = 0; i < lista.length; i++) {\n        resultado += lista[i] * Math.pow(2, i);\n    }\n    return resultado;\n}\n\nmsg.payload = multiplicarPorPotenciaDeDos(msg.payload);\n\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 690,
        "y": 240,
        "wires": [
            [
                "83e9887bf1d9926b"
            ]
        ]
    },
    {
        "id": "d0861668c327fb5c",
        "type": "inject",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "Update",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "0.2",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 380,
        "wires": [
            [
                "905d0fc69ad7a934",
                "500c1ce7ad4c9dcc",
                "7649d68fc7e0a399",
                "57108bc05b3d00cb",
                "23502c88421a88cf",
                "24430309ee419f39",
                "2343e22235c97f26",
                "07100da0cad0b41f",
                "3a058c50c53a544b",
                "e7160b3caa235341",
                "fe8d3f7d3c96684d",
                "f6ec31236d48ae6e",
                "e5c452de983324e2"
            ]
        ]
    },
    {
        "id": "47ef536b9d86f9fe",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "decimalToBytes",
        "func": "// Extract the decimal number from the previous node's msg.payload\nvar decimalNumber = msg.payload;\n\n// Function to convert a decimal number into 2 bytes represented as an array of decimal values\nfunction decimalToBytes(decimal) {\n    // Ensure the input number is within the valid range for 2 bytes (0 - 65535)\n    if (decimal < 0 || decimal > 65535) {\n        throw new Error(\"Decimal number must be between 0 and 65535.\");\n    }\n\n    // Calculate the most significant byte (MSB) by dividing by 256\n    var msb = Math.floor(decimal / 256);\n\n    // Calculate the least significant byte (LSB) by getting the remainder after dividing by 256\n    var lsb = decimal % 256;\n\n    // Add 6 zeros at the end of the array\n    return [msb, lsb];\n}\n\n// Convert the decimal number to bytes\nvar bytes = decimalToBytes(decimalNumber);\n\n// Output the result\nmsg.payload = bytes;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 420,
        "wires": [
            [
                "cd6051dca0c2e330"
            ]
        ]
    },
    {
        "id": "20d0b6a3a2e61c6a",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "decimalToBytes",
        "func": "// Extract the decimal number from the previous node's msg.payload\nvar decimalNumber = msg.payload;\n\n// Function to convert a decimal number into 2 bytes represented as an array of decimal values\nfunction decimalToBytes(decimal) {\n    // Ensure the input number is within the valid range for 2 bytes (0 - 65535)\n    if (decimal < 0 || decimal > 65535) {\n        throw new Error(\"Decimal number must be between 0 and 65535.\");\n    }\n\n    // Calculate the most significant byte (MSB) by dividing by 256\n    var msb = Math.floor(decimal / 256);\n\n    // Calculate the least significant byte (LSB) by getting the remainder after dividing by 256\n    var lsb = decimal % 256;\n\n    // Add 6 zeros at the end of the array\n    return [msb, lsb];\n}\n\n// Convert the decimal number to bytes\nvar bytes = decimalToBytes(decimalNumber);\n\n// Output the result\nmsg.payload = bytes;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 460,
        "wires": [
            [
                "cd6051dca0c2e330"
            ]
        ]
    },
    {
        "id": "224c68b588b4b2c6",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "decimalToBytes",
        "func": "// Extract the decimal number from the previous node's msg.payload\nvar decimalNumber = msg.payload;\n\n// Function to convert a decimal number into 2 bytes represented as an array of decimal values\nfunction decimalToBytes(decimal) {\n    // Ensure the input number is within the valid range for 2 bytes (0 - 65535)\n    if (decimal < 0 || decimal > 65535) {\n        throw new Error(\"Decimal number must be between 0 and 65535.\");\n    }\n\n    // Calculate the most significant byte (MSB) by dividing by 256\n    var msb = Math.floor(decimal / 256);\n\n    // Calculate the least significant byte (LSB) by getting the remainder after dividing by 256\n    var lsb = decimal % 256;\n\n    // Add 6 zeros at the end of the array\n    return [msb, lsb];\n}\n\n// Convert the decimal number to bytes\nvar bytes = decimalToBytes(decimalNumber);\n\n// Output the result\nmsg.payload = bytes;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 500,
        "wires": [
            [
                "cd6051dca0c2e330"
            ]
        ]
    },
    {
        "id": "f36976de5e56ed6d",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "decimalToBytes",
        "func": "// Extract the decimal number from the previous node's msg.payload\nvar decimalNumber = msg.payload;\n\n// Function to convert a decimal number into 2 bytes represented as an array of decimal values\nfunction decimalToBytes(decimal) {\n    // Ensure the input number is within the valid range for 2 bytes (0 - 65535)\n    if (decimal < 0 || decimal > 65535) {\n        throw new Error(\"Decimal number must be between 0 and 65535.\");\n    }\n\n    // Calculate the most significant byte (MSB) by dividing by 256\n    var msb = Math.floor(decimal / 256);\n\n    // Calculate the least significant byte (LSB) by getting the remainder after dividing by 256\n    var lsb = decimal % 256;\n\n    // Add 6 zeros at the end of the array\n    return [msb, lsb];\n}\n\n// Convert the decimal number to bytes\nvar bytes = decimalToBytes(decimalNumber);\n\n// Output the result\nmsg.payload = bytes;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 540,
        "wires": [
            [
                "cd6051dca0c2e330"
            ]
        ]
    },
    {
        "id": "2a9b6d53c769aaaf",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "decimalToBytes",
        "func": "// Extract the decimal number from the previous node's msg.payload\nvar decimalNumber = msg.payload;\n\n// Function to convert a decimal number into 2 bytes represented as an array of decimal values\nfunction decimalToBytes(decimal) {\n    // Ensure the input number is within the valid range for 2 bytes (0 - 65535)\n    if (decimal < 0 || decimal > 65535) {\n        throw new Error(\"Decimal number must be between 0 and 65535.\");\n    }\n\n    // Calculate the most significant byte (MSB) by dividing by 256\n    var msb = Math.floor(decimal / 256);\n\n    // Calculate the least significant byte (LSB) by getting the remainder after dividing by 256\n    var lsb = decimal % 256;\n\n    // Add 6 zeros at the end of the array\n    return [msb, lsb];\n}\n\n// Convert the decimal number to bytes\nvar bytes = decimalToBytes(decimalNumber);\n\n// Output the result\nmsg.payload = bytes;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 580,
        "wires": [
            [
                "cd6051dca0c2e330"
            ]
        ]
    },
    {
        "id": "51926e6a67f34716",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "decimalToBytes",
        "func": "// Extract the decimal number from the previous node's msg.payload\nvar decimalNumber = msg.payload;\n\n// Function to convert a decimal number into 2 bytes represented as an array of decimal values\nfunction decimalToBytes(decimal) {\n    // Ensure the input number is within the valid range for 2 bytes (0 - 65535)\n    if (decimal < 0 || decimal > 65535) {\n        throw new Error(\"Decimal number must be between 0 and 65535.\");\n    }\n\n    // Calculate the most significant byte (MSB) by dividing by 256\n    var msb = Math.floor(decimal / 256);\n\n    // Calculate the least significant byte (LSB) by getting the remainder after dividing by 256\n    var lsb = decimal % 256;\n\n    // Add 6 zeros at the end of the array\n    return [msb, lsb];\n}\n\n// Convert the decimal number to bytes\nvar bytes = decimalToBytes(decimalNumber);\n\n// Output the result\nmsg.payload = bytes;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 620,
        "wires": [
            [
                "cd6051dca0c2e330"
            ]
        ]
    },
    {
        "id": "cd6051dca0c2e330",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "valueArray",
        "func": "// Increment the number of received arrays and accumulate the current array\ncontext.set('numArrays', context.get('numArrays') + 1);\ncontext.set('finalArray', context.get('finalArray').concat(msg.payload));\n\n// If we have received all arrays, concatenate them and output the result\nif (context.get('numArrays') === 6) {\n    msg.payload = context.get('finalArray');\n    context.set('finalArray', [])\n    context.set('numArrays', 0)\n    return msg;\n}\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\n// Initialize a variable to store the accumulated arrays\ncontext.set('finalArray', context.get('finalArray') || []);\n\n// Initialize a variable to keep track of the number of received arrays\ncontext.set('numArrays', context.get('numArrays') || 0);",
        "finalize": "",
        "libs": [],
        "x": 690,
        "y": 320,
        "wires": [
            [
                "fdd6e6e80eff0d3c"
            ]
        ]
    },
    {
        "id": "108ede58e2d061e3",
        "type": "switch",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "name": "",
        "property": "parts.index",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "7",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "6",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "5",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "4",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 8,
        "x": 1650,
        "y": 260,
        "wires": [
            [
                "b9131811d9df1407"
            ],
            [
                "f9ed148ee00d0d97"
            ],
            [
                "497cb3d1b4448af5"
            ],
            [
                "ca913802a2c75bd5"
            ],
            [
                "dcf640263f170103"
            ],
            [
                "59396664d736a82d"
            ],
            [
                "d614fe7be9f57c6b"
            ],
            [
                "715dcb755eca1d99"
            ]
        ]
    },
    {
        "id": "39e35f6c254a0369",
        "type": "split",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": "1",
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 1530,
        "y": 260,
        "wires": [
            [
                "108ede58e2d061e3"
            ]
        ]
    },
    {
        "id": "dbe719e96fa66ed5",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "getCoilOUT",
        "func": "// Función para convertir el primer valor de msg.payload a binario\nvar valor = msg.payload[0]; // Obtener el primer valor de msg.payload\nvar binario = valor.toString(2); // Convertir a binario\n\n// Rellenar con ceros a la izquierda para obtener una cadena de 8 bits\nbinario = binario.padStart(8, '0');\n\n// Crear una lista con los valores binarios\nvar listaBinaria = binario.split('').map(Number);\n\n// Enviar la lista como mensaje\nmsg.payload = listaBinaria;\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1330,
        "y": 260,
        "wires": [
            [
                "39e35f6c254a0369"
            ]
        ]
    },
    {
        "id": "ab940c74db66bee1",
        "type": "rpiplc-set-config",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "rpiplc": "6528c316998e5dca",
        "name": "",
        "x": 1060,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "0c32e8a40efd7b65",
        "type": "rpiplc-analog-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "A0.5",
        "value": "",
        "name": "",
        "x": 1820,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "a99bbc7d8ffa4db9",
        "type": "rpiplc-analog-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "A0.6",
        "value": "",
        "name": "",
        "x": 1820,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "460f8e82d4fdb890",
        "type": "rpiplc-analog-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "A0.7",
        "value": "",
        "name": "",
        "x": 1820,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "07100da0cad0b41f",
        "type": "rpiplc-analog-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.7",
        "name": "",
        "x": 300,
        "y": 420,
        "wires": [
            [
                "47ef536b9d86f9fe"
            ]
        ]
    },
    {
        "id": "e5c452de983324e2",
        "type": "rpiplc-analog-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.12",
        "name": "",
        "x": 300,
        "y": 620,
        "wires": [
            [
                "51926e6a67f34716"
            ]
        ]
    },
    {
        "id": "f6ec31236d48ae6e",
        "type": "rpiplc-analog-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.11",
        "name": "",
        "x": 300,
        "y": 580,
        "wires": [
            [
                "2a9b6d53c769aaaf"
            ]
        ]
    },
    {
        "id": "fe8d3f7d3c96684d",
        "type": "rpiplc-analog-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.10",
        "name": "",
        "x": 300,
        "y": 540,
        "wires": [
            [
                "f36976de5e56ed6d"
            ]
        ]
    },
    {
        "id": "e7160b3caa235341",
        "type": "rpiplc-analog-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.9",
        "name": "",
        "x": 300,
        "y": 500,
        "wires": [
            [
                "224c68b588b4b2c6"
            ]
        ]
    },
    {
        "id": "3a058c50c53a544b",
        "type": "rpiplc-analog-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.8",
        "name": "",
        "x": 300,
        "y": 460,
        "wires": [
            [
                "20d0b6a3a2e61c6a"
            ]
        ]
    },
    {
        "id": "500c1ce7ad4c9dcc",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.6",
        "name": "",
        "x": 300,
        "y": 360,
        "wires": [
            [
                "4b5246fc6ad2d3e8"
            ]
        ]
    },
    {
        "id": "7649d68fc7e0a399",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.5",
        "name": "",
        "x": 300,
        "y": 320,
        "wires": [
            [
                "3b0a9e706f8aeb7f"
            ]
        ]
    },
    {
        "id": "57108bc05b3d00cb",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.4",
        "name": "",
        "x": 300,
        "y": 280,
        "wires": [
            [
                "8f867cf458a43d6c"
            ]
        ]
    },
    {
        "id": "23502c88421a88cf",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.3",
        "name": "",
        "x": 300,
        "y": 240,
        "wires": [
            [
                "af55f2c0ee32b627"
            ]
        ]
    },
    {
        "id": "24430309ee419f39",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.2",
        "name": "",
        "x": 300,
        "y": 200,
        "wires": [
            [
                "97169286d4553246"
            ]
        ]
    },
    {
        "id": "2343e22235c97f26",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.1",
        "name": "",
        "x": 300,
        "y": 160,
        "wires": [
            [
                "dac62bb90b6d6ee5"
            ]
        ]
    },
    {
        "id": "905d0fc69ad7a934",
        "type": "rpiplc-digital-read",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "rpiplc": "6528c316998e5dca",
        "pin": "I0.0",
        "name": "",
        "x": 300,
        "y": 120,
        "wires": [
            [
                "9044d20129e62e54"
            ]
        ]
    },
    {
        "id": "715dcb755eca1d99",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "d": true,
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.7",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "d614fe7be9f57c6b",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "d": true,
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.6",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "59396664d736a82d",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "d": true,
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.5",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 480,
        "wires": [
            []
        ]
    },
    {
        "id": "dcf640263f170103",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.4",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "ca913802a2c75bd5",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.3",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "497cb3d1b4448af5",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.2",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "f9ed148ee00d0d97",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.1",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "b9131811d9df1407",
        "type": "rpiplc-digital-write",
        "z": "cfae12731057c553",
        "g": "2fc8282c5c588387",
        "rpiplc": "6528c316998e5dca",
        "pin": "Q0.0",
        "value": "",
        "name": "",
        "x": 1890,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "99088db4f7401535",
        "type": "modbus-server",
        "z": "cfae12731057c553",
        "g": "2857a0031c45b08a",
        "name": "",
        "logEnabled": false,
        "hostname": "10.10.10.20",
        "serverPort": "502",
        "responseDelay": 100,
        "delayUnit": "ms",
        "coilsBufferSize": "5",
        "holdingBufferSize": "3",
        "inputBufferSize": "2",
        "discreteBufferSize": "10",
        "showErrors": false,
        "x": 1080,
        "y": 280,
        "wires": [
            [
                "3248205cc2c9a929",
                "6b12fafcb26841d2"
            ],
            [
                "d388e85f2fe1b27f",
                "dbe719e96fa66ed5"
            ],
            [
                "4b2f2756de30a0b0"
            ],
            [
                "73e06c069369b560"
            ],
            []
        ]
    },
    {
        "id": "9044d20129e62e54",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 0;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 120,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "dac62bb90b6d6ee5",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 1;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 160,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "97169286d4553246",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 2;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 200,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "af55f2c0ee32b627",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 3;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 240,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "8f867cf458a43d6c",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 4;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 280,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "3b0a9e706f8aeb7f",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 5;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 320,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "4b5246fc6ad2d3e8",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "setOrder",
        "func": "msg.inputOrder = 6;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 395,
        "y": 360,
        "wires": [
            [
                "319434f75d7b950b"
            ]
        ],
        "l": false
    },
    {
        "id": "319434f75d7b950b",
        "type": "join",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "",
        "propertyType": "full",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "7",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "num",
        "reduceFixup": "",
        "x": 495,
        "y": 240,
        "wires": [
            [
                "3da80d769e2bb631"
            ]
        ],
        "l": false
    },
    {
        "id": "3da80d769e2bb631",
        "type": "function",
        "z": "cfae12731057c553",
        "g": "7c4e39d1729d6570",
        "name": "sortInputs",
        "func": "let inputList = [0,0,0,0,0,0,0]\n\nfor (let i = 0; i < msg.payload.length; i++) {\n    let index =msg.payload[i].inputOrder;\n    let variable = msg.payload[i].payload;\n\n    inputList[index] = variable;\n}\n\nmsg.payload = inputList;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 565,
        "y": 240,
        "wires": [
            [
                "81ca1264f54fc252"
            ]
        ],
        "l": false
    },
    {
        "id": "6528c316998e5dca",
        "type": "rpiplc-config",
        "isCustom": false,
        "version": "RPIPLC_V4",
        "model": "RPIPLC_21",
        "name": ""
    }
]