How to write multiple data to Modbus Server efficiently?

Hi everyone, I've only just learned to use node-red a short while ago and don't know much about Javascript (but I can get AI to help).

I would like to ask a question:
I have a total of 6 data to upload to Modbus Server now, but later I will plan to upload ten and more data, if I still follow the current method, it will make the work cost more. What is the best way to increase the efficiency?

Below is my flow:

[
    {
        "id": "a021a58553f87da9",
        "type": "tab",
        "label": "物联网 demo 测试",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "1964653c8868349d",
        "type": "group",
        "z": "a021a58553f87da9",
        "style": {
            "stroke": "#999999",
            "stroke-opacity": "1",
            "fill": "none",
            "fill-opacity": "1",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "db194b3a981add30",
            "d6bd6820cc9c86c4",
            "2d11710d8950e6b0",
            "ca5832a1a8687599",
            "3dacf9589ea47ed6",
            "baf7dab8bc12de02",
            "657b712d240c8b9e",
            "4083025c0899d485",
            "49c68e7312599925",
            "91406028333b4757",
            "0f9d16a881e6d926",
            "722bbb3ff5d8c3ab"
        ],
        "x": 254,
        "y": 79,
        "w": 872,
        "h": 422
    },
    {
        "id": "3c4c8ee1c0e8b06f",
        "type": "group",
        "z": "a021a58553f87da9",
        "style": {
            "stroke": "#999999",
            "stroke-opacity": "1",
            "fill": "none",
            "fill-opacity": "1",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "84425a7eb012ce1e",
            "dea8d86c68bb5e34",
            "972d12e07fdac55a",
            "5e24e053f497b8d6",
            "19514fe8f6cbd369",
            "561d7e41803d66fe"
        ],
        "x": 254,
        "y": 519,
        "w": 692,
        "h": 242
    },
    {
        "id": "b091717ec90e710f",
        "type": "group",
        "z": "a021a58553f87da9",
        "style": {
            "stroke": "#999999",
            "stroke-opacity": "1",
            "fill": "none",
            "fill-opacity": "1",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "aed82866809e0eb3",
            "fa6698a7a0c342ef",
            "6219c63f8289f41c",
            "2330626e4eac6a89",
            "381ebb1a749733e7",
            "4872de3d7499e5cb",
            "c4a7cc7ba8e9e048",
            "84c5f0c0d77aeb14",
            "8e4f5c17e6c885b8"
        ],
        "x": 254,
        "y": 779,
        "w": 752,
        "h": 322
    },
    {
        "id": "db194b3a981add30",
        "type": "modbus-flex-sequencer",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "模拟量",
        "sequences": [
            {
                "name": "模拟量1",
                "unitid": "4",
                "fc": "FC4",
                "address": "0",
                "quantity": "2"
            }
        ],
        "server": "3ab6da8a17d3a981",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 570,
        "y": 440,
        "wires": [
            [
                "91406028333b4757",
                "d6bd6820cc9c86c4"
            ],
            [
                "dea8d86c68bb5e34"
            ]
        ]
    },
    {
        "id": "d6bd6820cc9c86c4",
        "type": "modbus-response",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "",
        "registerShowMax": 20,
        "x": 830,
        "y": 460,
        "wires": []
    },
    {
        "id": "2d11710d8950e6b0",
        "type": "modbus-flex-sequencer",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "数字量输入",
        "sequences": [
            {
                "name": "数字量输入1",
                "unitid": "2",
                "fc": "FC4",
                "address": "0",
                "quantity": "2"
            }
        ],
        "server": "3ab6da8a17d3a981",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 590,
        "y": 200,
        "wires": [
            [
                "ca5832a1a8687599",
                "4083025c0899d485"
            ],
            [
                "3dacf9589ea47ed6"
            ]
        ]
    },
    {
        "id": "ca5832a1a8687599",
        "type": "modbus-response",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "",
        "registerShowMax": 20,
        "x": 830,
        "y": 220,
        "wires": []
    },
    {
        "id": "3dacf9589ea47ed6",
        "type": "modbus-flex-sequencer",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "温湿度",
        "sequences": [
            {
                "name": "温度",
                "unitid": "3",
                "fc": "FC4",
                "address": "0",
                "quantity": "2"
            }
        ],
        "server": "3ab6da8a17d3a981",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 570,
        "y": 320,
        "wires": [
            [
                "49c68e7312599925",
                "baf7dab8bc12de02"
            ],
            [
                "db194b3a981add30"
            ]
        ]
    },
    {
        "id": "baf7dab8bc12de02",
        "type": "modbus-response",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "",
        "registerShowMax": 20,
        "x": 830,
        "y": 340,
        "wires": []
    },
    {
        "id": "657b712d240c8b9e",
        "type": "inject",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "0.5",
        "crontab": "",
        "once": false,
        "onceDelay": "0.25",
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 350,
        "y": 200,
        "wires": [
            [
                "2d11710d8950e6b0"
            ]
        ]
    },
    {
        "id": "4083025c0899d485",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "设置全局变量",
        "func": "msg.payload.key1 = msg.payload[0]; // 添加新的属性并赋值\nmsg.payload.key2 = msg.payload[1];\n\nglobal.set(\"key1\", msg.payload.key1); // 设置全局变量\nglobal.set(\"key2\", msg.payload.key2);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "49c68e7312599925",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "设置全局变量",
        "func": "msg.payload.temperature = msg.payload[0]; // 添加新的属性并赋值\nmsg.payload.humidity = msg.payload[1];\n\nglobal.set(\"temperature\", msg.payload.temperature); // 设置全局变量\nglobal.set(\"humidity\", msg.payload.humidity);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 280,
        "wires": [
            [
                "722bbb3ff5d8c3ab"
            ]
        ]
    },
    {
        "id": "91406028333b4757",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "设置全局变量",
        "func": "msg.payload.voltage1 = msg.payload[0]; // 添加新的属性并赋值\nmsg.payload.voltage2 = msg.payload[1];\n\nglobal.set(\"voltage1\", msg.payload.voltage1); // 设置全局变量\nglobal.set(\"voltage2\", msg.payload.voltage2);\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "0f9d16a881e6d926",
        "type": "comment",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "读取传感器数据",
        "info": "",
        "x": 360,
        "y": 120,
        "wires": []
    },
    {
        "id": "84425a7eb012ce1e",
        "type": "modbus-write",
        "z": "a021a58553f87da9",
        "g": "3c4c8ee1c0e8b06f",
        "name": "写寄存器",
        "showStatusActivities": false,
        "showErrors": false,
        "unitid": "2",
        "dataType": "HoldingRegister",
        "adr": "0",
        "quantity": "1",
        "server": "3ab6da8a17d3a981",
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 800,
        "y": 640,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "dea8d86c68bb5e34",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "3c4c8ee1c0e8b06f",
        "name": "FC3 2 0 [1]",
        "func": "msg.payload = { \n    'fc': 3, \n    'unitid': 2, \n    'address': 0 , \n    'quantity': 1 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 680,
        "wires": [
            [
                "972d12e07fdac55a"
            ]
        ]
    },
    {
        "id": "972d12e07fdac55a",
        "type": "modbus-flex-getter",
        "z": "a021a58553f87da9",
        "g": "3c4c8ee1c0e8b06f",
        "name": "50000",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "server": "244ca65087e1d0d0",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 610,
        "y": 680,
        "wires": [
            [
                "5e24e053f497b8d6",
                "84425a7eb012ce1e"
            ],
            []
        ]
    },
    {
        "id": "5e24e053f497b8d6",
        "type": "modbus-response",
        "z": "a021a58553f87da9",
        "g": "3c4c8ee1c0e8b06f",
        "name": "",
        "registerShowMax": 20,
        "x": 830,
        "y": 720,
        "wires": []
    },
    {
        "id": "19514fe8f6cbd369",
        "type": "comment",
        "z": "a021a58553f87da9",
        "g": "3c4c8ee1c0e8b06f",
        "name": "控制风扇开关",
        "info": "",
        "x": 350,
        "y": 560,
        "wires": []
    },
    {
        "id": "561d7e41803d66fe",
        "type": "comment",
        "z": "a021a58553f87da9",
        "g": "3c4c8ee1c0e8b06f",
        "name": "获取来自Modbus Server的值",
        "info": "",
        "x": 480,
        "y": 640,
        "wires": []
    },
    {
        "id": "aed82866809e0eb3",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "temperature",
        "func": "msg.payload = { \n    'value': global.get(\"temperature\"), \n    'register': 'input', \n    'address': 0, \n    'disableMsgOutput': 0 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 630,
        "y": 860,
        "wires": [
            [
                "fa6698a7a0c342ef"
            ]
        ]
    },
    {
        "id": "fa6698a7a0c342ef",
        "type": "modbus-server",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "",
        "logEnabled": false,
        "hostname": "0.0.0.0",
        "serverPort": "50000",
        "responseDelay": 100,
        "delayUnit": "ms",
        "coilsBufferSize": "10",
        "holdingBufferSize": "10",
        "inputBufferSize": "10",
        "discreteBufferSize": "10",
        "showErrors": false,
        "x": 900,
        "y": 960,
        "wires": [
            [],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "6219c63f8289f41c",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "humidity",
        "func": "msg.payload = { \n    'value': global.get(\"humidity\"), \n    'register': 'input', \n    'address': 1, \n    'disableMsgOutput': 0 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 900,
        "wires": [
            [
                "fa6698a7a0c342ef"
            ]
        ]
    },
    {
        "id": "2330626e4eac6a89",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "voltage1",
        "func": "msg.payload = { \n    'value': global.get(\"voltage1\"), \n    'register': 'input', \n    'address': 2, \n    'disableMsgOutput': 0 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 940,
        "wires": [
            [
                "fa6698a7a0c342ef"
            ]
        ]
    },
    {
        "id": "381ebb1a749733e7",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "voltage2",
        "func": "msg.payload = { \n    'value': global.get(\"voltage2\"), \n    'register': 'input', \n    'address': 3, \n    'disableMsgOutput': 0 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 980,
        "wires": [
            [
                "fa6698a7a0c342ef"
            ]
        ]
    },
    {
        "id": "4872de3d7499e5cb",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "key1",
        "func": "msg.payload = { \n    'value': global.get(\"key1\"), \n    'register': 'input', \n    'address': 4, \n    'disableMsgOutput': 0 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 610,
        "y": 1020,
        "wires": [
            [
                "fa6698a7a0c342ef"
            ]
        ]
    },
    {
        "id": "c4a7cc7ba8e9e048",
        "type": "function",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "key2",
        "func": "msg.payload = { \n    'value': global.get(\"key2\"), \n    'register': 'input', \n    'address': 5, \n    'disableMsgOutput': 0 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 610,
        "y": 1060,
        "wires": [
            [
                "fa6698a7a0c342ef"
            ]
        ]
    },
    {
        "id": "84c5f0c0d77aeb14",
        "type": "comment",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "数据上传至 Modbus Server",
        "info": "",
        "x": 390,
        "y": 820,
        "wires": []
    },
    {
        "id": "8e4f5c17e6c885b8",
        "type": "inject",
        "z": "a021a58553f87da9",
        "g": "b091717ec90e710f",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": "0.25",
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 370,
        "y": 960,
        "wires": [
            [
                "aed82866809e0eb3",
                "6219c63f8289f41c",
                "2330626e4eac6a89",
                "381ebb1a749733e7",
                "4872de3d7499e5cb",
                "c4a7cc7ba8e9e048"
            ]
        ]
    },
    {
        "id": "722bbb3ff5d8c3ab",
        "type": "debug",
        "z": "a021a58553f87da9",
        "g": "1964653c8868349d",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload.temperature",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1020,
        "y": 280,
        "wires": []
    },
    {
        "id": "3ab6da8a17d3a981",
        "type": "modbus-client",
        "name": "",
        "clienttype": "simpleser",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttySTM2",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "60",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true
    },
    {
        "id": "244ca65087e1d0d0",
        "type": "modbus-client",
        "name": "",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "0.0.0.0",
        "tcpPort": "50000",
        "tcpType": "TCP-RTU-BUFFERED",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true
    }
]

Another question is this:
Each piece of data takes up 4 bytes, am I setting something up wrong? I want to make them all consecutive.

As in the picture:

Does the fact that you ask this mean that you have solved your previous post? If so then please mark a post there as a solution or post what the solution was.

In the previous post you were reading from multiple devices. If you are still doing that then you must do them as separate transactions. If you want to read or write multiple registers to the same device then you may be able to read/write a block of registers.

好的,我已标注解决方案,感谢提醒。

我会尝试你提供的方法的。

OK, I have marked the solution, thanks for reminding me.

I will try the method you provided.