question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Q] Reccomended way to query multiple devices Addresses

See original GitHub issue

Simple 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:

  1. One Felx-Getter with multiple inputs grafik

  2. Multiple Flex-Getters reading only one value at dedicated register address

  3. 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.

  • Node: (v14.x) node --version = v14.17.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
anversoftcommented, Sep 17, 2021

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.

image

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

1reaction
anversoftcommented, Aug 26, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview | I2C addresses! - Adafruit Learning System
I2C is incredibly popular because it uses only 2 wires, and like we said, multiple devices can share those wires, making it a...
Read more >
Create a query based on multiple tables - Microsoft Support
Use the Query Wizard to build a query from a primary table and a related table. Ensure that the tables have a defined...
Read more >
Work with multi-statement queries | BigQuery - Google Cloud
Write, run, and save multi-statement queries. A multi-statement query consists of one or more SQL statements separated by semicolons. Any valid SQL statement ......
Read more >
SCCM CMPivot Query Examples - System Center Dudes
This post lists 55 SCCM CMPivot Query Examples. ... List a device based on it's IPv4 address, IPConfig | where (IPV4Address == '192.168.1.1 ......
Read more >
Query on Discovery Schedule Best Practice - ServiceNow
IP Address Range:-You can define arbitrary ranges of IP addresses to query. This process is a good way to include selected segments of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found