Errors in MODBUS RTU communication

Hello grant1,
Thank you for your adding so much info about your setup. Hope this helps more beginners to setup a sensible modbus RTU flow. There is not so much info about reading more than one modbus slaves.

@Colin About errors when slave is off. I saw lots of errors too when one of the fuses was off and I was trying to read use on it's meter. I didn't save the logs. The setup as in post 1-method 1 with read-modbus nodes enabled for meters 1 and 2.

Well that method is not reliable, as discussed earlier.

Using the Getter node with the nodes wired in series (two different ways, using both of the outputs, just in case I was misreading the instructions), I was able to only get a value / reading from the first controller in the flow (#301). The other Modbus Getter nodes do not show a yellow dot (error), but as you can see I am getting errors in the debug pane.

Hi @grant1 Did you uncheck UnitId's in parallel ?

Sharing my flow that is working for me .. im using Flex getters though .. dont know if its any different

[{"id":"50f4d5f8.e58de4","type":"function","z":"89e2edc2.2ff858","name":"error","func":"\nlet time = moment().format('YYYY-MM-DD HH:mm:ss')\n\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\n    global.set(\"Status.Status_31\", \"Disconnected\")\n    node.status({ fill: \"red\", shape: \"ring\", text: `Last disconnected ${time}` });\n\n    msg.payload = {\n\n        V_31_L1: null,\n        V_31_L2: null,\n        V_31_L3: null,\n        A_31_L1: null,\n        A_31_L2: null,\n        A_31_L3: null,\n        P_31_L1: null,\n        P_31_L2: null,\n        P_31_L3: null,\n        P_31_T: null,\n        S_31_T: null,\n        Q_31_T: null,\n        PF_31_L1: null,\n        PF_31_L2: null,\n        PF_31_L3: null,\n        F_31_L1: null,\n        F_31_L2: null,\n        F_31_L3: null\n    }\n\n    return [null, msg]\n}\n\nelse {\n    global.set(\"Status.Status_31\", \"Connected\")\n    return [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"moment","module":"moment"}],"x":420,"y":120,"wires":[["92dcda2.7f34fa8"],["249147b.1d31cb8"]]},{"id":"12901b2f.4ba98d","type":"function","z":"89e2edc2.2ff858","name":"error","func":"\nlet time = moment().format('YYYY-MM-DD HH:mm:ss')\n\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\nglobal.set(\"Status.Status_31\", \"Disconnected\")   \nnode.status({fill:\"red\",shape:\"ring\",text:`Last disconnected ${time}`});\n\nmsg.payload = { \n        THDV_31_L1: null,\n        THDV_31_L2: null,\n        THDV_31_L3: null,\n        THDA_31_L1: null,\n        THDA_31_L2: null,\n        THDA_31_L3: null\n    }\n    \nreturn [null, msg]\n}\n\nelse {\n    global.set(\"Status.Status_31\", \"Connected\")\nreturn [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"moment","module":"moment"}],"x":420,"y":180,"wires":[["686e6999.6ccb7"],["249147b.1d31cb8"]]},{"id":"c3916662.130968","type":"function","z":"89e2edc2.2ff858","name":"error","func":"\nlet time = moment().format('YYYY-MM-DD HH:mm:ss')\n\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n    \nglobal.set(\"Status.Status_31\", \"Disconnected\")\nnode.status({fill:\"red\",shape:\"ring\",text:`Last disconnected ${time}`});\n\nmsg.payload = { \n        EI_31_T: null,\n        EI_31_L1: null,\n        EI_31_L2: null,\n        EI_31_L3: null\n    }\n    \nreturn [null, msg]\n}\n\nelse {\n    \nglobal.set(\"Status.Status_31\", \"Connected\")\nreturn [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"moment","module":"moment"}],"x":420,"y":240,"wires":[["10965d7a.1396c3"],["249147b.1d31cb8"]]},{"id":"e8dc045b.48c8c8","type":"function","z":"89e2edc2.2ff858","name":"","func":"msg.payload = { \n    value: msg.payload, \n    'fc': 4, \n    'unitid': 31, \n    'address': 1, \n    'quantity': 64 \n} \n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":145,"y":120,"wires":[["4e1b9529.80c94c"]],"l":false},{"id":"8404bc9.cd00f4","type":"function","z":"89e2edc2.2ff858","name":"","func":"msg.payload = { \n    value: msg.payload, \n    'fc': 4, \n    'unitid': 31, \n    'address': 105, \n    'quantity': 12\n} \n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":145,"y":180,"wires":[["6d63b87d.1b20d"]],"l":false},{"id":"f41281dd.2bfbb","type":"function","z":"89e2edc2.2ff858","name":"","func":"msg.payload = { \n    value: msg.payload, \n    'fc': 4, \n    'unitid': 31, \n    'address': 6799, \n    'quantity': 12 \n} \n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":145,"y":240,"wires":[["b352a18a.8bb0e8"]],"l":false},{"id":"432976d9.6e39e","type":"debug","z":"89e2edc2.2ff858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":480,"y":60,"wires":[]},{"id":"4e1b9529.80c94c","type":"modbus-flex-getter","z":"89e2edc2.2ff858","name":"ELNET31a","showStatusActivities":true,"showErrors":false,"logIOActivities":false,"server":"c6d958ad.ea6e1","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":false,"x":260,"y":120,"wires":[["50f4d5f8.e58de4","8404bc9.cd00f4","432976d9.6e39e"],[]]},{"id":"6d63b87d.1b20d","type":"modbus-flex-getter","z":"89e2edc2.2ff858","name":"ELNET31b","showStatusActivities":true,"showErrors":false,"logIOActivities":false,"server":"c6d958ad.ea6e1","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":false,"x":260,"y":180,"wires":[["12901b2f.4ba98d","f41281dd.2bfbb"],[]]},{"id":"b352a18a.8bb0e8","type":"modbus-flex-getter","z":"89e2edc2.2ff858","name":"ELNET31c","showStatusActivities":true,"showErrors":false,"logIOActivities":false,"server":"c6d958ad.ea6e1","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":false,"x":260,"y":240,"wires":[["c3916662.130968","20e0a1d5.fbc25e"],[]]},{"id":"d8789881.b3cbf","type":"cronplus","z":"89e2edc2.2ff858","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"trigger","topic":"trigger","payloadType":"bool","payload":"true","expressionType":"cron","expression":"0 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":160,"y":40,"wires":[["e8dc045b.48c8c8"]]},{"id":"92dcda2.7f34fa8","type":"buffer-parser","z":"89e2edc2.2ff858","name":"Group1","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"V_31_L1","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"V_31_L2","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"V_31_L3","offset":8,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"A_31_L1","offset":24,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"A_31_L2","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"A_31_L3","offset":32,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"P_31_L1","offset":36,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"P_31_L2","offset":40,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"P_31_L3","offset":44,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"P_31_T","offset":48,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"S_31_T","offset":64,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"Q_31_T","offset":80,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"PF_31_L1","offset":84,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"PF_31_L2","offset":88,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"PF_31_L3","offset":92,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"F_31_L1","offset":100,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"F_31_L2","offset":104,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"F_31_L3","offset":108,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":570,"y":120,"wires":[["249147b.1d31cb8"]]},{"id":"686e6999.6ccb7","type":"buffer-parser","z":"89e2edc2.2ff858","name":"Group2","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"THDV_31_L1","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"THDV_31_L2","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"THDV_31_L3","offset":8,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"THDA_31_L1","offset":12,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"THDA_31_L2","offset":16,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"THDA_31_L3","offset":20,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":570,"y":180,"wires":[["249147b.1d31cb8"]]},{"id":"10965d7a.1396c3","type":"buffer-parser","z":"89e2edc2.2ff858","name":"Group3","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"EI_31_T","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"EI_31_L1","offset":12,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"EI_31_L2","offset":16,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatbe","name":"EI_31_L3","offset":20,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":570,"y":240,"wires":[["249147b.1d31cb8"]]},{"id":"c6d958ad.ea6e1","type":"modbus-client","name":"","clienttype":"serial","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"failureLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"38400","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":31,"commandDelay":200,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":false}]

image

First results of testing new flow are good! The serial connector settings are very important. It didn't run with Queue delay1 ms, after slowing down to 100 ms it worked.
These are the working settings:

1 Like

You are right....I forgot to uncheck UnitIDs in Parallel. Unfortunately I cannot test until Monday because the plant is closed for the weekend. May also need to experiment with the Queue delay per @rob2.

I will report back on Tue morning.

I Did some experiments with the daisy-chained flow. All stays working fine now till one (or more) of the meters does not react (I shut one and two down to test it). In that case the chains stops till the meter(s) starts reacting again.
I saw no errors at all, no catch all node messages and no status node messages, nothing.

I need to find out a way to always start next node at any point in the flow if it does not get a proper startpulse from a malfunctioning node to keep it running.

yes .. by default the Modbus nodes dont output a msg when they fail to poll a device.
Unless you enable that option. (See the flow i shared above)

image

This will trigger the next Modbus node in the chain.
But i also used a Function node to filter those fails and handle them differently and not send them to buffer-parser.

Have you enabled the options ?

image

So to recap, I implemented 3 Modbus-getter nodes wired in series (vs. 3 Modbus-read nodes wired separately with random timers to avoid collisions). I unchecked UnitIDs in Parallel.

At the time of my experiment, units #301 and #305 were running (#303 was switched off). The results were generally the same as when I had the 3 Read nodes:

Here is the result when I remove #303 from the flow (no errors):

I fiddled with every possible setting and even imported the flow from @UnborN (modified with my modbus settings, but using his Flex Getter nodes) and still got errors when #303 was in the flow.

I may try to return to this later and implement some more changes that @Steve-Mcl suggested or the error handling function nodes that @UnborN used.

Thanks for everyone's input.

.. so if 301 and 305 is running it means that there is some misconfiguration with 303
have you checked that all devices have unique ids .. that they are set on the same baud rate, parity etc

can you share your flow ? (up to the point of those Function nodes .. no need for the influx part)

@UnborN Sorry for the delay, and thanks for your help. Here is the flow:

[{"id":"63e449375249c53d","type":"modbus-getter","z":"66e28e413f49c527","name":"#301 Dew Point","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"11","dataType":"InputRegister","adr":"123","quantity":"15","server":"fc8c6b99462d5d50","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":160,"y":700,"wires":[["0aaa4ff937aa50ed","ecf3c1d75d3b3b02"],[]]},{"id":"5b1833bab50720ba","type":"inject","z":"66e28e413f49c527","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":600,"wires":[["63e449375249c53d"]]},{"id":"0aaa4ff937aa50ed","type":"buffer-parser","z":"66e28e413f49c527","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"MB30124","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"MB30136","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":700,"wires":[["32c45a7cea26e585"]]},{"id":"32c45a7cea26e585","type":"function","z":"66e28e413f49c527","name":"","func":"msg.payload = [\n    [{\n        DewPoint: msg.payload[0]\n    },\n    {\n        MeasType:\"actual\",\n        EquipNumber:\"301\"\n    }],\n    [{\n        DewPoint: msg.payload[1]\n    },\n    {\n        MeasType:\"setpoint\",\n        EquipNumber:\"301\"\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":700,"wires":[["697c681cb0e03635"]]},{"id":"c375555cb709af44","type":"mqtt out","z":"66e28e413f49c527","name":"","topic":"Generator301/dewpoint/actual","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"518d2b1ee44c4692","x":1010,"y":740,"wires":[]},{"id":"697c681cb0e03635","type":"change","z":"66e28e413f49c527","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0][0].DewPoint","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":740,"wires":[["c375555cb709af44","64ea030b555c6d30"]]},{"id":"64ea030b555c6d30","type":"debug","z":"66e28e413f49c527","name":"#301","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":800,"wires":[]},{"id":"ecf3c1d75d3b3b02","type":"modbus-getter","z":"66e28e413f49c527","name":"#303 Dew Point","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"2","dataType":"InputRegister","adr":"122","quantity":"16","server":"fc8c6b99462d5d50","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":160,"y":860,"wires":[["5f0138154f74e651","2e0ec6b343c61ad8"],[]]},{"id":"5f0138154f74e651","type":"modbus-getter","z":"66e28e413f49c527","name":"#305 Dew Point","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"5","dataType":"InputRegister","adr":"123","quantity":"16","server":"fc8c6b99462d5d50","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":140,"y":1020,"wires":[["f5120a835722d1a5"],[]]},{"id":"2e0ec6b343c61ad8","type":"buffer-parser","z":"66e28e413f49c527","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"MB30124","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"MB30136","offset":30,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":390,"y":860,"wires":[["ef0bc6f6d894ea76"]]},{"id":"ef0bc6f6d894ea76","type":"function","z":"66e28e413f49c527","name":"","func":"msg.payload = [\n    [{\n        DewPoint: msg.payload[0]\n    },\n    {\n        MeasType:\"actual\",\n        EquipNumber:\"303\"\n    }],\n    [{\n        DewPoint: msg.payload[1]\n    },\n    {\n        MeasType:\"setpoint\",\n        EquipNumber:\"303\"\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":860,"wires":[["8f60741eb5529cd8"]]},{"id":"8f60741eb5529cd8","type":"change","z":"66e28e413f49c527","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0][0].DewPoint","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":900,"wires":[["aa5b586f57efa74d","67a6c9d0972a9335"]]},{"id":"aa5b586f57efa74d","type":"mqtt out","z":"66e28e413f49c527","name":"","topic":"Generator303/dewpoint/actual","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"518d2b1ee44c4692","x":1010,"y":900,"wires":[]},{"id":"67a6c9d0972a9335","type":"debug","z":"66e28e413f49c527","name":"#303","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":960,"wires":[]},{"id":"f5120a835722d1a5","type":"buffer-parser","z":"66e28e413f49c527","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"MB30124","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"MB30136","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":350,"y":1040,"wires":[["18d574521c602843"]]},{"id":"18d574521c602843","type":"function","z":"66e28e413f49c527","name":"","func":"msg.payload = [\n    [{\n        DewPoint: msg.payload[0]\n    },\n    {\n        MeasType:\"actual\",\n        EquipNumber:\"305\"\n    }],\n    [{\n        DewPoint: msg.payload[1]\n    },\n    {\n        MeasType:\"setpoint\",\n        EquipNumber:\"305\"\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":1020,"wires":[["bb26947af7abb9cc"]]},{"id":"bb26947af7abb9cc","type":"change","z":"66e28e413f49c527","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0][0].DewPoint","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1060,"wires":[["a4cff2e16dac1993","7482504ccd973296"]]},{"id":"a4cff2e16dac1993","type":"mqtt out","z":"66e28e413f49c527","name":"","topic":"Generator305/dewpoint/actual","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"518d2b1ee44c4692","x":1010,"y":1060,"wires":[]},{"id":"7482504ccd973296","type":"debug","z":"66e28e413f49c527","name":"#305","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":1120,"wires":[]},{"id":"fc8c6b99462d5d50","type":"modbus-client","name":"serial_to_USB","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":true,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttySer0","serialType":"RTU-BUFFERD","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"","commandDelay":"2000","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":false},{"id":"518d2b1ee44c4692","type":"mqtt-broker","name":"","broker":"192.168.10.25","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

The above is this (non-working) flow:

At the current time, Gen. 301 and 303 are switched off. If I change the inject node to flow directly into the 305 Modbus node, it works:

I have double checked all the Unit-IDs on each modbus controller and they are correct (11: #301, 2: #303, 5: #305)

Looking at your JSON I see emptyMsgOnFail: false

This suggests that when one of the modbus actions in the sequence fail, a msg will NOT be emitted (thus the chain stops).

Isnt there an option on the modbus node to send msg on fail?

1 Like

Thanks. There is an option (which was unchecked), so I checked it for all 3 nodes...
image

But upon restarting the flow, I get this:

put a switch before buffer-parser to ensure the data is as expected. (i.e. filter out bad messages)

Check this Flow ..

  1. replaced the Getter with Flex Getters .. they seem to be more stable
  2. enabled empty msg on fail .. so the chain is not broken and added error checking so buffer-parcer doesnt get a failed msg
  3. tweaked your timeout values and pre-delay .. that was way to high (2000)
    (you were sending msgs every 5 seconds and the pre-delay was 2s and the timeout .. by the time all these settings do their thing a new trigger msg arrived and the queue was all clattered)
[{"id":"0aaa4ff937aa50ed","type":"buffer-parser","z":"54efb553244c241f","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"MB30124","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"MB30136","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":610,"y":3780,"wires":[["32c45a7cea26e585"]]},{"id":"32c45a7cea26e585","type":"function","z":"54efb553244c241f","name":"","func":"msg.payload = [\n    [{\n        DewPoint: msg.payload[0]\n    },\n    {\n        MeasType:\"actual\",\n        EquipNumber:\"301\"\n    }],\n    [{\n        DewPoint: msg.payload[1]\n    },\n    {\n        MeasType:\"setpoint\",\n        EquipNumber:\"301\"\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":3780,"wires":[["697c681cb0e03635"]]},{"id":"c375555cb709af44","type":"mqtt out","z":"54efb553244c241f","name":"","topic":"Generator301/dewpoint/actual","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"518d2b1ee44c4692","x":1210,"y":3780,"wires":[]},{"id":"697c681cb0e03635","type":"change","z":"54efb553244c241f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0][0].DewPoint","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":3780,"wires":[["c375555cb709af44","64ea030b555c6d30"]]},{"id":"64ea030b555c6d30","type":"debug","z":"54efb553244c241f","name":"#301","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1130,"y":3740,"wires":[]},{"id":"2e0ec6b343c61ad8","type":"buffer-parser","z":"54efb553244c241f","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"MB30124","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"MB30136","offset":30,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":610,"y":3940,"wires":[["ef0bc6f6d894ea76"]]},{"id":"ef0bc6f6d894ea76","type":"function","z":"54efb553244c241f","name":"","func":"msg.payload = [\n    [{\n        DewPoint: msg.payload[0]\n    },\n    {\n        MeasType:\"actual\",\n        EquipNumber:\"303\"\n    }],\n    [{\n        DewPoint: msg.payload[1]\n    },\n    {\n        MeasType:\"setpoint\",\n        EquipNumber:\"303\"\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":3940,"wires":[["8f60741eb5529cd8"]]},{"id":"8f60741eb5529cd8","type":"change","z":"54efb553244c241f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0][0].DewPoint","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":3940,"wires":[["aa5b586f57efa74d","67a6c9d0972a9335"]]},{"id":"aa5b586f57efa74d","type":"mqtt out","z":"54efb553244c241f","name":"","topic":"Generator303/dewpoint/actual","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"518d2b1ee44c4692","x":1210,"y":3940,"wires":[]},{"id":"67a6c9d0972a9335","type":"debug","z":"54efb553244c241f","name":"#303","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":3900,"wires":[]},{"id":"f5120a835722d1a5","type":"buffer-parser","z":"54efb553244c241f","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"MB30124","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"MB30136","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":610,"y":4120,"wires":[["18d574521c602843"]]},{"id":"18d574521c602843","type":"function","z":"54efb553244c241f","name":"","func":"msg.payload = [\n    [{\n        DewPoint: msg.payload[0]\n    },\n    {\n        MeasType:\"actual\",\n        EquipNumber:\"305\"\n    }],\n    [{\n        DewPoint: msg.payload[1]\n    },\n    {\n        MeasType:\"setpoint\",\n        EquipNumber:\"305\"\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":4120,"wires":[["bb26947af7abb9cc"]]},{"id":"bb26947af7abb9cc","type":"change","z":"54efb553244c241f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0][0].DewPoint","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":4120,"wires":[["a4cff2e16dac1993","7482504ccd973296"]]},{"id":"a4cff2e16dac1993","type":"mqtt out","z":"54efb553244c241f","name":"","topic":"Generator305/dewpoint/actual","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"518d2b1ee44c4692","x":1210,"y":4120,"wires":[]},{"id":"7482504ccd973296","type":"debug","z":"54efb553244c241f","name":"#305","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":4080,"wires":[]},{"id":"3fdd911012ee99a7","type":"modbus-flex-getter","z":"54efb553244c241f","name":"#301 Dew Point","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"fc8c6b99462d5d50","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":false,"x":260,"y":3780,"wires":[["79e759c0e36079e0"],[]]},{"id":"c887ef2ecfe3f83b","type":"modbus-flex-getter","z":"54efb553244c241f","name":"#303 Dew Point","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"fc8c6b99462d5d50","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":false,"x":260,"y":3940,"wires":[["6d975f494f6b5766"],[]]},{"id":"24a56188855fb52f","type":"modbus-flex-getter","z":"54efb553244c241f","name":"#305 Dew Point","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"fc8c6b99462d5d50","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":false,"x":260,"y":4120,"wires":[["327fca40293f38f1"],[]]},{"id":"5b1833bab50720ba","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":3680,"wires":[["8568325dac8def16"]]},{"id":"8568325dac8def16","type":"function","z":"54efb553244c241f","name":"","func":"msg.topic = \"301\"\n\nmsg.payload = {\n    value: msg.payload,\n    'fc': 4,\n    'unitid': 11,\n    'address': 123,\n    'quantity': 15\n}\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":145,"y":3780,"wires":[["3fdd911012ee99a7"]],"l":false},{"id":"62979849be1ce00f","type":"function","z":"54efb553244c241f","name":"","func":"msg.topic = \"303\"\n\nmsg.payload = { \n    value: msg.payload, \n    'fc': 4, \n    'unitid': 2, \n    'address': 122, \n    'quantity': 16\n} \n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":145,"y":3940,"wires":[["c887ef2ecfe3f83b"]],"l":false},{"id":"79e759c0e36079e0","type":"function","z":"54efb553244c241f","name":"error","func":"\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\n    node.status({ fill: \"red\", shape: \"ring\", text: `Error` });\n\n    return [null, msg]\n}\n\nelse {\n\n    return [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":3780,"wires":[["0aaa4ff937aa50ed"],["62979849be1ce00f"]]},{"id":"6d975f494f6b5766","type":"function","z":"54efb553244c241f","name":"error","func":"\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\n    node.status({ fill: \"red\", shape: \"ring\", text: `Error` });\n\n    return [null, msg]\n}\n\nelse {\n\n    return [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":3940,"wires":[["2e0ec6b343c61ad8"],["285fa2f6233ce96a"]]},{"id":"327fca40293f38f1","type":"function","z":"54efb553244c241f","name":"error","func":"\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\n    node.status({ fill: \"red\", shape: \"ring\", text: `Error` });\n\n    return [null, msg]\n}\n\nelse {\n\n    return [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":4120,"wires":[["f5120a835722d1a5"],[]]},{"id":"285fa2f6233ce96a","type":"function","z":"54efb553244c241f","name":"","func":"msg.topic = \"305\"\n\nmsg.payload = { \n    value: msg.payload, \n    'fc': 4, \n    'unitid': 5, \n    'address': 123, \n    'quantity': 16 \n} \n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":145,"y":4120,"wires":[["24a56188855fb52f"]],"l":false},{"id":"518d2b1ee44c4692","type":"mqtt-broker","name":"","broker":"192.168.10.25","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"fc8c6b99462d5d50","type":"modbus-client","name":"serial_to_USB","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":true,"failureLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttySer0","serialType":"RTU-BUFFERD","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"","commandDelay":"50","clientTimeout":"200","reconnectOnTimeout":true,"reconnectTimeout":"1000","parallelUnitIdsAllowed":false}]

Thanks. Importing your flow and running, I am still getting errors:

Also, just to be clear, these are the settings:

I put 3 new debug nodes (x301, x303, x305) and I do not get errors, but I do not get any values. See below. I think we are getting close...

i noticed something strange .. from the screenshot of your config i see that you have less options than in mine ..

image

what version of Modbus nodes are you running ?

image

v5.21.2

Updating now to v5.23.1 and will report back...

image

Upgraded to v5.23.1 and still getting errors (and no values on the 3 newly placed debug nodes)...

Settings: