Modbus write/read collisions

i'm using rs485 modbus on a project, i have around 6 flex getter nodes, and 2 flex write nodes on different flows. what i notice is when i have a flex read interval of 1 second, the write node is stuck in queuing mode and has trouble getting messages through. i would think and believe i have seen people with a ton of nodes that this isn't a problem. my flow is huge so its hard to post it, i'm mostly just looking for conceptual answers about how modbus read timing can limit the ability for the write to happen. maybe i'm having unrealistic expectations, however i would think a read of 1 second shouldn't lock everything up. i'm on a raspberry pi and the plc is a controllino maxi.

thanks for any insight

I came across similar trouble using serial (rs485) Modbus. Using several flex getter and flex write nodes is asking for instability. Better concentrate the Modbus communication in one flow. Use only one flex getter node and one flex write node in your system. For every command read or write you have to wait for the response before you can issue a next read or write command. This is essential for the reliability.

I use MQTT to communicate to the Modbus flow. The Modbus commands are queued and only after a command is processed the next command is released from the queue. I keep a queue of max 10 commands. There are no delays build in the communication itself so the command processing is always at maximum speed. Problems can occur when the line is broken but this will not cause trouble in the software. Once reconnected the system will smoothly continue again.

[{"id":"10bf8854.2715a8","type":"subflow","name":"Log telegram","info":"msg.payload = \"telegram message\"","category":"","in":[{"x":320,"y":180,"wires":[{"id":"a671d8a45d9081b5"}]}],"out":[],"env":[],"meta":{},"color":"#DDAA99"},{"id":"cbfc7c50.4160b","type":"mqtt out","z":"10bf8854.2715a8","name":"","topic":"notify_to_telegram","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ddcae42b.d2a648","x":1030,"y":180,"wires":[]},{"id":"c1a55339c5a25232","type":"change","z":"10bf8854.2715a8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Bericht van uw Domotica systeem","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":180,"wires":[["cbfc7c50.4160b"]]},{"id":"a671d8a45d9081b5","type":"simpletime","z":"10bf8854.2715a8","name":"dts","mydate":true,"myymd":false,"myyear":false,"mymonth":false,"mymonthn":false,"mydom":false,"mydoy":false,"myday":false,"myhourpm":false,"myhour":false,"mytime":true,"mytimes":false,"myminute":false,"myminutes":false,"mysecond":false,"mymillis":false,"myepoch":false,"myrawdate":false,"mypm":false,"x":470,"y":180,"wires":[["94b8fd1303b384d7"]]},{"id":"94b8fd1303b384d7","type":"function","z":"10bf8854.2715a8","name":"prep msg","func":"msg.payload = msg.mydate + \" \" + msg.mytime + \" \" + msg.payload; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":180,"wires":[["c1a55339c5a25232"]]},{"id":"638a76dc.d3cf28","type":"subflow","name":"Log email","info":"msg.payload = \"email message\"","category":"","in":[{"x":240,"y":140,"wires":[{"id":"66e2850f.56402c"}]}],"out":[],"env":[],"meta":{},"color":"#DDAA99"},{"id":"66e2850f.56402c","type":"mqtt out","z":"638a76dc.d3cf28","name":"","topic":"notify_to_email","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ddcae42b.d2a648","x":520,"y":140,"wires":[]},{"id":"28322648.b9e59a","type":"subflow","name":"Log notification","info":"msg.payload = \"notification\"","category":"","in":[{"x":220,"y":120,"wires":[{"id":"f66b845a.608628"}]}],"out":[],"env":[],"meta":{},"color":"#DDAA99"},{"id":"f66b845a.608628","type":"mqtt out","z":"28322648.b9e59a","name":"Notification","topic":"notification","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ddcae42b.d2a648","x":450,"y":120,"wires":[]},{"id":"50764a8442578d57","type":"modbus-flex-getter","z":"b7c41944ac2e6897","name":"Modbus read","showStatusActivities":false,"showErrors":false,"showWarnings":true,"logIOActivities":false,"server":"7abf41938dcd043f","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":1190,"y":240,"wires":[["f355d90a46325cdd","0cfe9b4f60508e0e"],[]]},{"id":"995bc3172e02b7de","type":"function","z":"b7c41944ac2e6897","name":"Test FC","func":"if (msg.payload.fc <= 4)\n    return ([msg, null]);\nelse\n    return ([null, msg]);","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":280,"wires":[["50764a8442578d57"],["bfa6470c8837d5b3"]]},{"id":"bfa6470c8837d5b3","type":"modbus-flex-write","z":"b7c41944ac2e6897","name":"Modbus write","showStatusActivities":false,"showErrors":false,"showWarnings":true,"server":"7abf41938dcd043f","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":1190,"y":320,"wires":[["f355d90a46325cdd","0cfe9b4f60508e0e"],[]]},{"id":"560c13e77e569b2c","type":"function","z":"b7c41944ac2e6897","name":"Trigger sender","func":"msg.payload.device = flow.get('device');\nmsg.topic = flow.get('link');\nif (msg.hasOwnProperty ('responseBuffer')) {\n    msg.payload = {};\n    msg.payload.responseBuffer = msg.responseBuffer;\n    msg.payload.device = flow.get('device');\n}\nif (flow.get ('q_status') === \"queue\") return [{ topic: \"control\", payload: \"trigger\" }, msg, msg];\nelse return [{ topic: \"control\", payload: \"open\" }, msg, msg];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":300,"wires":[["d6dfe994ca8d5c91"],["e7145ece35a12849"],["121cf92d1e53a65f"]]},{"id":"6c18635bb22b1392","type":"function","z":"b7c41944ac2e6897","name":"Reset retry trigger","func":"msg.reset = true;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":220,"wires":[["0e82d5a35279eb24"]]},{"id":"0e82d5a35279eb24","type":"trigger","z":"b7c41944ac2e6897","name":"Retry","op1":"","op2":"","op1type":"pay","op2type":"pay","duration":"-5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":790,"y":280,"wires":[["995bc3172e02b7de"]]},{"id":"d29d125c448855cd","type":"function","z":"b7c41944ac2e6897","name":"reset","func":"if (msg.payload === \"reset\") {\n    msg.reset = true;\n    return msg;\n}\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":280,"wires":[["0e82d5a35279eb24","df76670751b34000"]]},{"id":"99fd05c58fc23c83","type":"function","z":"b7c41944ac2e6897","name":"queue","func":"return { topic: \"control\", payload: \"queue\" };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":340,"wires":[["40ee8e216cced271"]]},{"id":"e2353733815ddf2e","type":"trigger","z":"b7c41944ac2e6897","name":"","op1":"","op2":"reset","op1type":"nul","op2type":"str","duration":"-5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1490,"y":180,"wires":[["603bfb43948efa1b"]]},{"id":"f887e9ae8bd1b51b","type":"function","z":"b7c41944ac2e6897","name":"reset queue","func":"return { topic: \"control\", payload: \"reset\" };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1710,"y":160,"wires":[["653900719ea0d554"]]},{"id":"4d24a679ade999c1","type":"link out","z":"b7c41944ac2e6897","name":"link out 13","mode":"link","links":["149e72d43db375ae","7461cb4e72f2ba99"],"x":1855,"y":140,"wires":[]},{"id":"149e72d43db375ae","type":"link in","z":"b7c41944ac2e6897","name":"link in 9","links":["90fecb8d8f6a8da6","4d24a679ade999c1","d6dfe994ca8d5c91"],"x":305,"y":420,"wires":[["40ee8e216cced271"]]},{"id":"d6dfe994ca8d5c91","type":"link out","z":"b7c41944ac2e6897","name":"link out 14","mode":"link","links":["149e72d43db375ae"],"x":1685,"y":260,"wires":[]},{"id":"121cf92d1e53a65f","type":"link out","z":"b7c41944ac2e6897","name":"link out 15","mode":"link","links":["7461cb4e72f2ba99"],"x":1685,"y":340,"wires":[]},{"id":"7461cb4e72f2ba99","type":"link in","z":"b7c41944ac2e6897","name":"link in 10","links":["4d24a679ade999c1","121cf92d1e53a65f"],"x":755,"y":220,"wires":[["6c18635bb22b1392"]]},{"id":"1ea7a838a29e58e9","type":"function","z":"b7c41944ac2e6897","name":"open queue","func":"return { topic: \"control\", payload: \"open\" };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2070,"y":180,"wires":[["90fecb8d8f6a8da6"]]},{"id":"f1a9550741cdf529","type":"delay","z":"b7c41944ac2e6897","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1900,"y":180,"wires":[["1ea7a838a29e58e9"]]},{"id":"90fecb8d8f6a8da6","type":"link out","z":"b7c41944ac2e6897","name":"link out 16","mode":"link","links":["149e72d43db375ae"],"x":2205,"y":180,"wires":[]},{"id":"df76670751b34000","type":"link out","z":"b7c41944ac2e6897","name":"link out 17","mode":"link","links":["e06e6cc699df0fd7"],"x":755,"y":60,"wires":[]},{"id":"e06e6cc699df0fd7","type":"link in","z":"b7c41944ac2e6897","name":"link in 11","links":["df76670751b34000"],"x":1525,"y":60,"wires":[["603bfb43948efa1b"]]},{"id":"02f6466dbd522429","type":"inject","z":"b7c41944ac2e6897","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":1210,"y":180,"wires":[["f355d90a46325cdd"]]},{"id":"40ee8e216cced271","type":"q-gate","z":"b7c41944ac2e6897","name":"Modbus cmd queue","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"peek","dropCmd":"drop","statusCmd":"status","maxQueueLength":"10","keepNewest":true,"qToggle":true,"persist":true,"storeName":"storeOnSD","x":470,"y":420,"wires":[["0e82d5a35279eb24","e8f7b6ec728ae4b7","99fd05c58fc23c83"]]},{"id":"f1545e03d0ffeda9","type":"function","z":"b7c41944ac2e6897","name":"if queuing = 0 ==> open","func":"if (msg.status.text === \"queuing: 0\") {flow.set('q_status', 'open'); node.status (\"\")} else flow.set('q_status', 'queue'); \nif (msg.status.text === \"queuing: 10\") {\n    msg.payload = \"Modbus communicatie gestopt\";\n    node.status (\"Modbus comm failure\");\n    return msg;\n};\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":520,"wires":[["d804570b3db34b39"]]},{"id":"e8f7b6ec728ae4b7","type":"function","z":"b7c41944ac2e6897","name":"Keep msg link","func":"flow.set('link', msg.payload.link);\nflow.set('device', msg.payload.device);\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":760,"y":420,"wires":[[]]},{"id":"8f163902463e194c","type":"mqtt in","z":"b7c41944ac2e6897","name":"Modbus","topic":"modbus_action","qos":"2","datatype":"auto-detect","broker":"ddcae42b.d2a648","nl":false,"rap":true,"rh":0,"inputs":0,"x":140,"y":280,"wires":[["4090dc1b2d84e5cc"]]},{"id":"e7145ece35a12849","type":"mqtt out","z":"b7c41944ac2e6897","name":"Modbus out","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ddcae42b.d2a648","x":2150,"y":300,"wires":[]},{"id":"3b03e7f983d4c819","type":"status","z":"b7c41944ac2e6897","name":"Queue status","scope":["40ee8e216cced271"],"x":450,"y":520,"wires":[["f1545e03d0ffeda9"]]},{"id":"0b6e135ba0a202a2","type":"subflow:28322648.b9e59a","z":"b7c41944ac2e6897","name":"","x":1120,"y":480,"wires":[]},{"id":"dec3b55cce8212e8","type":"subflow:638a76dc.d3cf28","z":"b7c41944ac2e6897","name":"","x":1100,"y":520,"wires":[]},{"id":"20495cf3f956580c","type":"subflow:10bf8854.2715a8","z":"b7c41944ac2e6897","name":"","x":1110,"y":560,"wires":[]},{"id":"d804570b3db34b39","type":"trigger","z":"b7c41944ac2e6897","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"1","extend":true,"overrideDelay":false,"units":"hr","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":880,"y":520,"wires":[["02e4db45f9aafa7a"]]},{"id":"10bf0aed4eab82a6","type":"inject","z":"b7c41944ac2e6897","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":1490,"y":120,"wires":[["603bfb43948efa1b"]]},{"id":"4090dc1b2d84e5cc","type":"junction","z":"b7c41944ac2e6897","x":250,"y":280,"wires":[["40ee8e216cced271","d29d125c448855cd"]]},{"id":"603bfb43948efa1b","type":"junction","z":"b7c41944ac2e6897","x":1620,"y":160,"wires":[["f887e9ae8bd1b51b"]]},{"id":"653900719ea0d554","type":"junction","z":"b7c41944ac2e6897","x":1800,"y":160,"wires":[["4d24a679ade999c1","f1a9550741cdf529"]]},{"id":"f355d90a46325cdd","type":"junction","z":"b7c41944ac2e6897","x":1370,"y":180,"wires":[["e2353733815ddf2e"]]},{"id":"0cfe9b4f60508e0e","type":"junction","z":"b7c41944ac2e6897","x":1370,"y":300,"wires":[["560c13e77e569b2c"]]},{"id":"02e4db45f9aafa7a","type":"junction","z":"b7c41944ac2e6897","x":980,"y":520,"wires":[["0b6e135ba0a202a2","dec3b55cce8212e8","20495cf3f956580c"]]},{"id":"7abf41938dcd043f","type":"modbus-client","name":"Modbus USB","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"$(MODBUSPORT)","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":1,"commandDelay":15,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":false,"showWarnings":true,"showLogs":true},{"id":"ddcae42b.d2a648","type":"mqtt-broker","name":"MQTT-broker","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

thank you for responding. i have some tasks that need to complete 1/sec is this a realistic goal? i also need to pull probably 80 registers, 30 of them for sure every second, and the rest maybe a tad slower, but still quick.

i don't know how mqtt works or what it even does really. i'm very interested in looking at the queue gate node. i have a total of 4 getters, and 2 writers but i guess i can just dump all the writes into one using a link. the reads i'm not sure how to trigger all of them reliably and process them through a functions node, maybe using message topic? i've tried this before and i with 4 different sets of modbus pulls, some get left behind and never happen, the ones with the fastest timing just take over the getter.

do you read all values in one hit or every single value individually?

That doesnt stop you cherry picking the functional parts to make a minimal example flow that would give us a clue to helping you.

i can only read 29 registers at a time otherwise it chokes.

here's a basic example of what i'm trying to do, it has 2 flex getters, i see people have like 10, but maybe they aren't triggering as fast. the problem is the write node is always queuing after these run for a little bit, which makes me think its too fast and the messages pile up. however i have 6 read nodes in another similar setup and it runs without problem, i can't find a difference.

readmodbus.json (8.3 KB)

would love to hear more from either of you.

i tried undestanding the mqtt flow, but i don't get it, as i don't really understand mqtt. i like the idea that i can queue stuff, however i might be limited by the speed with which modbus will answer my requests.

if steven has input as to something i can be doing better with flow i posted that would be great too.

i guess the main questions are these:

  1. can you (should you) have more than 1 flex getter on a flow
  2. can the flex getters handle pulling data from the registers every second AND handle the other pull requests that happen less frequently AND the occasinal flex write. seems like flex write is always the first to crap out.

sorry to bump, hoping to get some help here

You can try chaining your modbus nodes so that when a read happens it doesnt clash with a write.
Since you are doing multiple reads you can use the Modbus-Sequencer node.
(btw how many writes are you doing ? .. your flow doesnt have any modbus write nodes - added one to the example)

Here is an Example :

[{"id":"87eab1541aa32b42","type":"debug","z":"54efb553244c241f","name":"debug 26","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":1660,"wires":[]},{"id":"3f27cd9efa270149","type":"modbus-flex-write","z":"54efb553244c241f","name":"","showStatusActivities":true,"showErrors":true,"showWarnings":true,"server":"a1d4324da94c1365","emptyMsgOnFail":true,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":510,"y":1980,"wires":[[],[]]},{"id":"4eaf214784d4bff4","type":"function","z":"54efb553244c241f","name":"write configuration","func":"// your modbus-flex-write configuration\n// msg.payload = { value: 123, 'fc': 6, 'unitid': 1, 'address': 1 , 'quantity': 1 }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":1980,"wires":[["3f27cd9efa270149"]]},{"id":"843a81c760f4f2fb","type":"modbus-flex-getter","z":"54efb553244c241f","name":"","showStatusActivities":true,"showErrors":true,"showWarnings":true,"logIOActivities":false,"server":"a1d4324da94c1365","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":520,"y":1740,"wires":[["7ae3ad6f4532bf98","7749e2102398140d","87eab1541aa32b42"],[]]},{"id":"21a11c4492fea231","type":"function","z":"54efb553244c241f","name":"temp-current-state","func":"var fc = 3;\nvar sa = 50;\nvar addresses = 25;\n\nmsg.topic = 'critical.reads';\nmsg.payload = { 'fc': fc, 'unitid': 1, 'address': sa, 'quantity': addresses };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":1740,"wires":[["843a81c760f4f2fb"]]},{"id":"7ae3ad6f4532bf98","type":"function","z":"54efb553244c241f","name":"payloadVariableAssign","func":"\nif (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\n    return null\n}\n\nelse {\n\n    msg.z1Alarm = msg.payload[0];\n    msg.z2Alarm = msg.payload[1];\n    msg.z3Alarm = msg.payload[2];\n    msg.z4Alarm = msg.payload[3];\n    msg.z5Alarm = msg.payload[4];\n    msg.z1Temp = Math.ceil(msg.payload[5] / 10) / 10;\n    msg.z2Temp = Math.ceil(msg.payload[6] / 10) / 10;\n    msg.z3Temp = Math.ceil(msg.payload[7] / 10) / 10;\n    msg.z4Temp = Math.ceil(msg.payload[8] / 10) / 10;\n    msg.z5Temp = Math.ceil(msg.payload[9] / 10) / 10;\n    msg.z1Current = msg.payload[10];\n    msg.z2Current = msg.payload[11];\n    msg.z3Current = msg.payload[12];\n    msg.z4Current = msg.payload[13];\n    msg.z5Current = msg.payload[14];\n    msg.z1Status = msg.payload[15];\n    msg.z2Status = msg.payload[16];\n    msg.z3Status = msg.payload[17];\n    msg.z4Status = msg.payload[18];\n    msg.z5Status = msg.payload[19];\n    msg.z1TempSet = msg.payload[20];\n    msg.z2TempSet = msg.payload[21];\n    msg.z3TempSet = msg.payload[22];\n    msg.z4TempSet = msg.payload[23];\n    msg.z5TempSet = msg.payload[24];\n\n\n    msg.allTemps = [msg.z1Temp, msg.z2Temp, msg.z3Temp, msg.z4Temp, msg.z5Temp];\n\n    global.set('z1TempG', msg.payload[5]);\n    global.set('z2TempG', msg.payload[6]);\n    global.set('z3TempG', msg.payload[7]);\n    global.set('z4TempG', msg.payload[8]);\n    global.set('z5TempG', msg.payload[9]);\n\n\n    global.set('z1TempSetG', msg.payload[20]);\n    global.set('z2TempSetG', msg.payload[21]);\n    global.set('z3TempSetG', msg.payload[22]);\n    global.set('z4TempSetG', msg.payload[23]);\n    global.set('z5TempSetG', msg.payload[24]);\n\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":1720,"wires":[[]]},{"id":"58db080e978f81a6","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"}],"repeat":"1.5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":95,"y":1740,"wires":[["21a11c4492fea231"]],"l":false},{"id":"7c296c72dbe12fde","type":"modbus-flex-getter","z":"54efb553244c241f","name":"","showStatusActivities":true,"showErrors":true,"showWarnings":true,"logIOActivities":false,"server":"a1d4324da94c1365","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":520,"y":1860,"wires":[["d62fc1ec0d9ecf2c","4eaf214784d4bff4"],[]]},{"id":"7749e2102398140d","type":"function","z":"54efb553244c241f","name":"resistance-registers","func":"var fc = 3;\nvar sa = 115;\nvar addresses = 5;\n\nmsg.topic = 'zres';\nmsg.payload = { 'fc': fc, 'unitid': 1, 'address': sa, 'quantity': addresses };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":1860,"wires":[["7c296c72dbe12fde"]]},{"id":"d62fc1ec0d9ecf2c","type":"function","z":"54efb553244c241f","name":"payloadVariableAssign","func":"if (msg.payload == \"\" || msg.hasOwnProperty('error')) {\n\n    return null\n}\n\nelse {\n\n    msg.z1r = msg.payload[0] / 10;\n    msg.z2r = msg.payload[1] / 10;\n    msg.z3r = msg.payload[2] / 10;\n    msg.z4r = msg.payload[3] / 10;\n    msg.z5r = msg.payload[4] / 10;\n\n    msg.allRes = [msg.z1r, msg.z2r, msg.z3r, msg.z4r, msg.z5r];\n\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":1840,"wires":[[]]},{"id":"398f5c2958a374aa","type":"modbus-queue-info","z":"54efb553244c241f","name":"","topic":"","unitid":1,"queueReadIntervalTime":1000,"lowLowLevel":25,"lowLevel":75,"highLevel":150,"highHighLevel":300,"server":"a1d4324da94c1365","errorOnHighLevel":false,"showStatusActivities":true,"updateOnAllQueueChanges":false,"updateOnAllUnitQueues":false,"x":1080,"y":1660,"wires":[[]]},{"id":"a1d4324da94c1365","type":"modbus-client","name":"CONTROLLINO","clienttype":"serial","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":true,"failureLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyS0","serialType":"RTU-BUFFERD","serialBaudrate":"115200","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"1","commandDelay":"30","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":false}]

Further tweaks :

Unchecked the Unitid in parallel queues.
Increased the Queue delay ms to 30ms from 1ms to give some breathing space to each queued command.
Timeout was set to 15s .. i think that is to high .. reduced to 2s.
Enabled "Empty msg on Modbus fail" so even when one part of the chain fails it moves to the next and handled in Function nodes.

image

[EDIT] corrected the previous example that was using a Modbus Sequencer, as that would have created unnecessary duplicate msgs for the write nodes

1 Like

Hey, no real answers here but im also using 12 modbus devices without any issues.
Ill take a look at the speed we are doing it with and let you know how we have set up the node

thank you for the ideas, i will try this and check back in

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