Modbus choosing server by msg.payload

Hello,

I'm using node-red-contrib-modbus and i have over 60 ModBus TCP servers which I'm trying to connect to on demand selectively (i have no need to connect to them all at the same time). I get the server IP's from excel file that my co-workers are using. I'd like to avoid having 60 diffrently configured ModBus-Getter nodes specificly for each server, because it would mean having to update each node everytime something changes, and adding new nodes if theres a new server added.

Question is: how do i approach this? Which nodes should i use? How do i dynamicly select a server?
Ideally, i`d like to pass IP, port, unitID, function code, register and quantity via msg.payload object.

Thank you in advance!

Have you looked at the build in examples?

ctrl-i → examples → node-red-contrib-modbus

i am not 100% certain but I seem to recall there being a demo flow for this approach.

Okay, apparently all i needed was a little coffee break x)

The solution was ModBus Flex Connector node, which takes following params:
msg.payload = {
'connectorType': 'TCP',
'tcpHost': 'yourIPasString',
'tcpPort': 'yourPortAsString',
'unitId': yourUnitIdAsNumber
}
It takes a while for the node to connect with new server though.

Cheers!

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