Modbus global configuration node server

Hi,
Can I change modbus server with a command ?

Look into the Modbus Flex Connector Node .. (its in the modbus node collection)
It allows you to modify and reconnect with new connection parameters.
Read the node's side help for more information.

image

Thank you :slight_smile: But does it work when trying to change a communication from serial to TCP ?
Do I need to have seperate modbus TCP configuration in global configuration nodes ?

I havent tried it extensively. The only test i did was with some simulator modbus tcp devices changing the connection ip and port.

In the documentation it mentions that you can send the following msgs to it to change the connection parameters :

//Function node code examples for TCP:
msg.payload = { 'connectorType': 'TCP', 'tcpHost': '127.0.0.1', 'unitId': 2 } 
return msg 

msg.payload = { 'connectorType': 'TCP', 'tcpHost': '127.0.0.1', 'tcpPort': '10502', 'unitId': 2 } 
return msg

//Function node code example for SERIAL:
msg.payload = { 'connectorType': 'SERIAL', 'serialPort': '/dev/USB02', 'serialBaudrate': '9600' 'unitId': 2 } 
return msg

Theorecally by setting connectorType you can even switch between TCP and SERIAL
Only one way to find out .. have a go and let us know :wink:

ps. the only extra information i can give you is that i notice a small delay when switching connection settings which you must take into account before any read / write.

After injecting this payload.

msg.payload = { 'connectorType': 'TCP', 'tcpHost': '127.0.0.1', 'tcpPort': '1502', 'unitId': 2 } 
return msg

Communication stops and begins with serial communication again

Not enough information.
Can you share your flow ? .. not that we will be able to check much (since we dont have your devices) but at least we can see how you connected and configured everything