# Modbus-flex-getter repeat

**URL:** <https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905>\
**Category:** General\
**Tags:** function-node\
**Created:** [13 May 2024 05:22 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905 "2024-05-13T05:22:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![2shlee](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/2shlee/32/89413_2.png) [@2shlee](https://discourse.nodered.org/u/2shlee)\
**Post date:** [13 May 2024 05:22 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905/1 "2024-05-13T05:22:37Z")

</div>

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.

```auto
[
    {
        "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
    }
]

```

```auto
[
    {
        "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
    }
]

```

---

<div class="post-metadata">

**Author:** ![kitori](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kitori](https://discourse.nodered.org/u/kitori)\
**Post date:** [13 May 2024 07:06 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905/2 "2024-05-13T07:06:50Z")

</div>

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

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/274b369fa64e760b10bbdd6f5b9a6f89179ea871.png)

```auto
[{"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"]]}]

```

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [13 May 2024 11:53 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905/3 "2024-05-13T11:53:04Z")

</div>

> [@kitori](#):
>
> I'm sometimes getting errors if i read the bus to fast.

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/648ff19f768e61f2a979640b95e703ba4472a064.png)

increase it gradually until you get a stable read

---

<div class="post-metadata">

**Author:** ![2shlee](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/2shlee/32/89413_2.png) [@2shlee](https://discourse.nodered.org/u/2shlee)\
**Post date:** [14 May 2024 01:03 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905/4 "2024-05-14T01:03:50Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f1f82d69424f40763505f26ec69e298a6f293a0.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 May 2024 14:49 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905/5 "2024-05-14T14:49:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 August 2024 14:50 UTC](https://discourse.nodered.org/t/modbus-flex-getter-repeat/87905/6 "2024-08-12T14:50:29Z")

</div>

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