Does anyone have a working example of Modbus Flex Connector with the ability to dynamically connect to both TCP and SERIAL devices (using the most recent version of NR and node-red-contrib-modbus)? I have looked at MODSCAN - and although I have been able to get it working it still requires manually going into the Node-Red GUI and selecting the Link-out for either TCP or Serial connection before they will work, and I have found it's now not working with the latest updates to node-red-contrib-modbus (v5.8). I am looking for something that will allow changing the settings from Dashboard to switch between a WiFi/TCP and Serial RS-485 connection. I am using a Function as follows to input the settings to Modbus Flex Connector;
msg.payload = {
'connectorType': 'TCP',
'tcpHost': '192.168.1.36',
'tcpPort': '10502',
'unitId': '253'
};
return msg;
or
msg.payload = {
'connectorType':"SERIAL",
'serialPort': '/dev/ttyUSB0',
'serialType': 'RTU',
'serialBaudrate': '115200',
'unitId': '254'
};
return msg;
I currently have it working for the TCP connection, but when I try to switch to Serial it gives me a " Dynamic Reconnect Starts on actual state activated" message and then reconnects to TCP.
contribModbus:flex:connector dynamicReconnect: {"connectorType":"SERIAL","serialPort":"/dev/ttyUSB0","serialType":"RTU","serialBaudrate":"115200","unitId":"254"} +0ms
contribModbus:core:client Dynamic Reconnect Parameters {"connectorType":"SERIAL","serialPort":"/dev/ttyUSB0","serialType":"RTU","serialBaudrate":"115200","unitId":"254","emptyQueue":false} +1m
contribModbus:core:client New Connection Serial Settings /dev/ttyUSB0 115200 RTU +6ms
contribModbus:core:client Dynamic Reconnect Starts on actual state activated +1ms
2 Apr 22:56:46 - [warn] [modbus-client:ModbusConnect] Client -> init in 2000 ms TCP@192.168.1.36:502 default Unit-Id: 254
Any info on this would be much appreciated.