Modbus-flex-getter repeat

I'm working on getting data from 10 devices (which will be more than that later) every 15 minutes through the Modbus. After the initial injection, the data from Unit 1 to Unit 10 is received until 2 repetitions, but from the 3rd repetition, only the data for Unit 1 is output.
The code below is a flow using Modbus-flex-sequencer and a flow using Modbus-flex-Getter.
I wonder why if I repeat the subject, I only get the data for 1 device.

[
    {
        "id": "daa46ed480a8f68d",
        "type": "inject",
        "z": "53c7c787661b774e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "*/5 0-23 * * *",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 150,
        "y": 280,
        "wires": [
            [
                "b628e8293337ea17"
            ]
        ]
    },
    {
        "id": "b628e8293337ea17",
        "type": "modbus-flex-sequencer",
        "z": "53c7c787661b774e",
        "name": "",
        "sequences": [
            {
                "name": "1",
                "unitid": "1",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "2",
                "unitid": "2",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "3",
                "unitid": "3",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "4",
                "unitid": "4",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "5",
                "unitid": "5",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "6",
                "unitid": "6",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "7",
                "unitid": "7",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "8",
                "unitid": "8",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "9",
                "unitid": "9",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            },
            {
                "name": "10",
                "unitid": "10",
                "fc": "FC4",
                "address": "0",
                "quantity": "44"
            }
        ],
        "server": "fd93d7ae22777e95",
        "showStatusActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "logIOActivities": false,
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "delayOnStart": false,
        "startDelayTime": "100",
        "x": 380,
        "y": 280,
        "wires": [
            [
                "09bc7395f5bb11d3"
            ],
            []
        ],
        "info": "Server ์„ธํŒ…์—์„œ Timeout(ms)์ด 1000์œผ๋กœ ์„ค์ •์‹œ ์ „๋ ฅ๋Ÿ‰๊ณ„ ํ†ต์‹ ์ด 5~6๊ฐœ ํ†ต์‹ ์‹œ timeout ์—๋Ÿฌ ๋ฐœ์ƒ\r\nTimeout(ms)๋ฅผ 2000์œผ๋กœ ์„ธํ…กํ•˜๊ณ  ์‹œํ—˜์‹œ ํ˜„์žฌ 10๋Œ€ ๊นŒ์ง€ timeout ์—๋Ÿฌ ์—†์Šด\r\n"
    },
    {
        "id": "09bc7395f5bb11d3",
        "type": "debug",
        "z": "53c7c787661b774e",
        "name": "debug 169",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 690,
        "y": 180,
        "wires": []
    },
    {
        "id": "fd93d7ae22777e95",
        "type": "modbus-client",
        "name": "",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "192.168.0.109",
        "tcpPort": "502",
        "tcpType": "TCP-RTU-BUFFERED",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "0",
        "commandDelay": "1",
        "clientTimeout": "2000",
        "reconnectOnTimeout": false,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true,
        "showErrors": false,
        "showWarnings": true,
        "showLogs": true
    }
]
[
    {
        "id": "5d8fa1f26dbc0a26",
        "type": "inject",
        "z": "99b5bb1559959461",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "*/10 0-23 * * *",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 170,
        "y": 180,
        "wires": [
            [
                "82c7aebc13d89b4c",
                "d8c76d528ba7d452",
                "70645c6321e93714",
                "2737ca8693c47c40",
                "a7d6d8adfe6beb67",
                "7d1fdf5b72b0760e",
                "c9c4cf9a741b6515",
                "4aa1c7b43221b4a5",
                "737fd484e074b5ce",
                "d0a9f8f013203f06"
            ]
        ]
    },
    {
        "id": "176dec93eca7940c",
        "type": "debug",
        "z": "99b5bb1559959461",
        "name": "debug 175",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 820,
        "y": 240,
        "wires": []
    },
    {
        "id": "d0a9f8f013203f06",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 10",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':10,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 440,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "82c7aebc13d89b4c",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 1",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid': 1,\n    'address': 0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 80,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "70645c6321e93714",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 3",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':3,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 160,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "2737ca8693c47c40",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 4",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':4,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 200,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "a7d6d8adfe6beb67",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 5",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':5,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 240,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "7d1fdf5b72b0760e",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 6",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':6,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 280,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "c9c4cf9a741b6515",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 7",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':7,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 320,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "4aa1c7b43221b4a5",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 8",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':8,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 360,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "737fd484e074b5ce",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 9",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':9,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 400,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "d8c76d528ba7d452",
        "type": "function",
        "z": "99b5bb1559959461",
        "name": "unit 2 ",
        "func": "msg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid':2,\n    'address':0,\n    'quantity': 44\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 120,
        "wires": [
            [
                "defff319e2abe8ea"
            ]
        ]
    },
    {
        "id": "defff319e2abe8ea",
        "type": "modbus-flex-getter",
        "z": "99b5bb1559959461",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "logIOActivities": false,
        "server": "7745f4a9e5d503ef",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "delayOnStart": false,
        "startDelayTime": "",
        "x": 590,
        "y": 240,
        "wires": [
            [
                "176dec93eca7940c"
            ],
            []
        ]
    },
    {
        "id": "7745f4a9e5d503ef",
        "type": "modbus-client",
        "name": "",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": true,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "192.168.0.109",
        "tcpPort": "502",
        "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": "5000",
        "reconnectOnTimeout": false,
        "reconnectTimeout": "5000",
        "parallelUnitIdsAllowed": true,
        "showErrors": true,
        "showWarnings": true,
        "showLogs": true
    }
]

Did you try to spread out the read intervall on the Modbus?
I'm sometimes getting errors if i read the bus to fast.

[{"id":"166f1ab5988c0a3f","type":"function","z":"420aeb9f577edec9","name":"unitid 1-10","func":"for (let index = 1; index <= 10; index++) {\n    msg.payload = {\n        value: msg.payload,\n        'fc': 4,\n        'unitid': index,\n        'address': 0,\n        'quantity': 44\n    };  \nnode.send(msg);\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":420,"wires":[["3d793e046b71b44a"]]},{"id":"4e3a9e137ea584f1","type":"inject","z":"420aeb9f577edec9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":320,"y":420,"wires":[["166f1ab5988c0a3f"]]},{"id":"0f48cb23ae5d69a4","type":"debug","z":"420aeb9f577edec9","name":"debug 176","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":420,"wires":[]},{"id":"3d793e046b71b44a","type":"delay","z":"420aeb9f577edec9","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":720,"y":420,"wires":[["0f48cb23ae5d69a4"]]}]

i agree .. but there is a feature with the modbus Config nodes to queue the commands and define a delay.
There is no need to implement a delay yourself using the Delay node
Play around with the setting ..

image

increase it gradually until you get a stable read

1 Like

That was a good way.
But,
When I press the injection button, I get all the values for 10 units, but when I set it to a 15-minute cycle, if it repeats automatically, I still get only the data for unit 1.

image

Do you mean that if you disable the repeat, press the inject, then wait 15 minutes and press the inject again, and do the same 15 minutes later that it works correctly, but if you let the inject node do the repeat then it does not work?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.