[Q] Reccomended way to query multiple devices Addresses
See original GitHub issueSimple question to get some hint
- ( ) simple question => please visit the Wiki, the YouTube tutorials and the Info tab by clicking on the node inside Node-RED before
- (x) help wanted => you read all information and watched relevant YouTube tutorials, but you need more help
I’m using a Modbus RTU USB stick to read around 30+ addresses on multiple IDs. The help file recommends to use the flex getter when querying more than 10 adresses. Being my first real contact with Modbus over serial and more than 5 addresses, I’d like to ask for some advice regarding the recommended approach:
-
One Felx-Getter with multiple inputs
-
Multiple Flex-Getters reading only one value at dedicated register address
-
Flex-Getter reading huge Quantity of addresses in one go, splitting the response into single values later
Any advice on the best approach is highly appreciated. Many thanks in advance
Your Environment
Please tell us about your environment:
- (x) I am using just the Node-RED package and got modbus-serial package installed with it
- ( ) I have installed modbus-serial package global from source (using git clone)
- ( ) I have installed modbus-serial as a global package (using npm i -g)
Yes, modbus-serial is the name but it does all, TCP and Serial. The node-modbus package is just for the Modbus Server node.
-
Device :
- ( ) macOS: v
- (x) Linux: Ubuntu 20.04.2 LTS von RPi 3b+
- ( ) Windows: v
- ( ) Raspbian: v
- ( ) Other:
- Name:
- Version:
-
Description of the connecting Modbus system:
- Name : SH-U11G
- Version: n/a
- Vendor : DSD TECH
- Link : http://www.dsdtech-global.com/search/label/SH-U11 %3B USB RS485 %3B USB RS422
-
node-red-contrib-modbus version: v5.14.0
- Node: (v14.x)
node --version
= v14.17.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (10 by maintainers)
Top GitHub Comments
Also I recommend you to use this approach, it drastically reduces memory consumption and guarantees that the buffer will never fill up beyond what you requested.
[{"id":"f0131f16.70b96","type":"modbus-flex-sequencer","z":"bf644d16.1fc6b","name":"","sequences":[{"name":"1","unitid":"1","fc":"FC1","address":"4","quantity":"5"},{"name":"2","unitid":"3","fc":"FC2","address":"5","quantity":"6"}],"server":"2e5e8f26.89653","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":540,"y":300,"wires":[["75f9b163.aadc7","e2789d05.83284"],[]]},{"id":"98d52420.baa598","type":"inject","z":"bf644d16.1fc6b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":300,"y":300,"wires":[["f0131f16.70b96"]]},{"id":"75f9b163.aadc7","type":"join","z":"bf644d16.1fc6b","name":"","mode":"custom","build":"object","property":"","propertyType":"full","key":"name","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":780,"y":300,"wires":[["a199c840.31f288"]]},{"id":"a199c840.31f288","type":"function","z":"bf644d16.1fc6b","name":"Data Processing","func":"\nreturn [msg, msg, msg, msg, msg, msg];","outputs":6,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1240,"y":280,"wires":[["69f0d817.908a58"],["4238f86c.4b7948"],["1f1910f6.1c96ef"],["f425a752.149d08"],["ba980ea3.8f013"],["7dba0f55.78456"]]},{"id":"69f0d817.908a58","type":"function","z":"bf644d16.1fc6b","name":"Machine 1","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":260,"wires":[[]]},{"id":"4238f86c.4b7948","type":"function","z":"bf644d16.1fc6b","name":"Machine 2","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":300,"wires":[[]]},{"id":"1f1910f6.1c96ef","type":"function","z":"bf644d16.1fc6b","name":"Machine 3","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":340,"wires":[[]]},{"id":"f425a752.149d08","type":"function","z":"bf644d16.1fc6b","name":"Machine 4","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":380,"wires":[[]]},{"id":"ba980ea3.8f013","type":"function","z":"bf644d16.1fc6b","name":"Machine 5","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1480,"y":420,"wires":[[]]},{"id":"21e9f332.527c2c","type":"modbus-queue-info","z":"bf644d16.1fc6b","name":"All Queues","topic":"","unitid":1,"queueReadIntervalTime":1000,"lowLowLevel":25,"lowLevel":75,"highLevel":150,"highHighLevel":300,"server":"2e5e8f26.89653","errorOnHighLevel":false,"showStatusActivities":false,"updateOnAllQueueChanges":false,"updateOnAllUnitQueues":true,"x":490,"y":560,"wires":[[]]},{"id":"e2789d05.83284","type":"trigger","z":"bf644d16.1fc6b","name":"Watchdog","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"2","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":480,"y":440,"wires":[["3a5a6bd0.63ffa4","7dba0f55.78456"]]},{"id":"3a5a6bd0.63ffa4","type":"function","z":"bf644d16.1fc6b","name":"Send the msg.resetQueue = true","func":"msg.resetQueue = true;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":500,"wires":[["21e9f332.527c2c"]]},{"id":"846450b2.f81cb","type":"comment","z":"bf644d16.1fc6b","name":"If no message arrives for x seconds, reset the queue","info":"","x":510,"y":400,"wires":[]},{"id":"7dba0f55.78456","type":"delay","z":"bf644d16.1fc6b","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":860,"y":500,"wires":[["f0131f16.70b96"]]},{"id":"195ac5e9.c01f6a","type":"comment","z":"bf644d16.1fc6b","name":"Resend the messages after the data has been successfully processed","info":"","x":1050,"y":540,"wires":[]},{"id":"63c8e8fd.920da8","type":"comment","z":"bf644d16.1fc6b","name":"Send only once","info":"","x":300,"y":260,"wires":[]},{"id":"f879f1fa.a754d","type":"comment","z":"bf644d16.1fc6b","name":"Set the number of messages in the \"After a number of message parts\"","info":"","x":930,"y":260,"wires":[]},{"id":"2e5e8f26.89653","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]
In addition, you can use the new flex-sequencer that automatically manages the flow of multiple address requests.
node-red-contrib-modbus = v5.14.1