So this is my flow
[{"id":"ce085873429da727","type":"serial out","z":"5166dd2a7e38940b","name":"","serial":"bbc414bb7e1feaec","x":430,"y":340,"wires":[]},{"id":"ee4d246d01114515","type":"inject","z":"5166dd2a7e38940b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":290,"y":80,"wires":[["d079711f78c1baa8"]]},{"id":"d079711f78c1baa8","type":"function","z":"5166dd2a7e38940b","name":"","func":"msg.payload={ 'fc': 3, \n 'unitid': 3, \n 'address': 0 , \n 'quantity': 3 }; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":140,"wires":[["5db00c229ce0e15c"]]},{"id":"5db00c229ce0e15c","type":"modbus-flex-getter","z":"5166dd2a7e38940b","name":"","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"64e234ec8ad4b896","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":290,"y":180,"wires":[["4efbfd818ce4af96"],[]]},{"id":"4efbfd818ce4af96","type":"debug","z":"5166dd2a7e38940b","name":"sensor 3 raw data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":290,"y":240,"wires":[]},{"id":"add795f329a38cb4","type":"inject","z":"5166dd2a7e38940b","name":"\"string\", \" 0x3d\", \" 0x10\", 17","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"0x68\", \" 0x03\", \" 0x01\", \" 0x00\", \" 0x22\", \" 0xab\", \" 0x04\", \" 0x9b\", \" 0x04\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x48\", \" 0x3d\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x48\", \" 0x3e\", \" 0x4a\", \" 0x3a\", \" 0x4b\", \" 0x3a\", \" 0x4b\", \" 0x3a\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x4b\", \" 0xc0\", \" 0x01\", \" 0x47\", \" 0x3e\", \" 0x48\", \" 0x3d\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x4a\", \" 0x3b\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x47\", \" 0x3e\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0x3b\", \" 0x4d\", \" 0x38\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x4a\", \" 0xc2\", \" 0x01\", \" 0x47\", \" 0xc4\", \" 0x01\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x47\", \" 0xc5\", \" 0x01\", \" 0x4a\", \" 0xc2\", \" 0x01\", \" 0x47\", \" 0xc5\", \" 0x01\", \" 0x4a\", \" 0xc2\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x49\", \" 0xc2\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0x3f\", \" 0x49\", \" 0xc2\", \" 0x01\", \" 0x46\", \" 0x3f\", \" 0x46\", \" 0x3f\", \" 0x4a\", \" 0x3b\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0x3f\", \" 0x46\", \" 0x86\", \" 0x05\", \" 0xa7\", \" 0x04\", \" 0xa0\", \" 0x04\", \" 0x46\", \" 0x3f\", \" 0x46\", \" 0xc6\", \" 0x01\", \" 0x46\", \" 0x40\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x44\", \" 0xc7\", \" 0x01\", \" 0x42\", \" 0xca\", \" 0x01\", \" 0x42\", \" 0xca\", \" 0x01\", \" 0x42\", \" 0x44\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xcd\", \" 0x01\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0xcf\", \" 0x01\", \" 0x3d\", \" 0x10\", \" 0x16\"]","payloadType":"bin","x":220,"y":320,"wires":[["ce085873429da727","d6572391d59bb2cb"]]},{"id":"d6572391d59bb2cb","type":"debug","z":"5166dd2a7e38940b","name":"17 [\"0x68\", \"0x03\" ,]","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":300,"wires":[]},{"id":"bbc414bb7e1feaec","type":"serial-port","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":" ,","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"1","bin":"bin","out":"time","addchar":"","responsetimeout":"10000"},{"id":"64e234ec8ad4b896","type":"modbus-client","name":"RS485-1","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":1,"commandDelay":200,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}]
I want to have only one RS485 to usb connecter to control both serial and modbus device right now because 1 converter can have 255 devices connected to it and I only have less then 10 devices that is needed to connected to the RS485.
I need to dynamically connect and disable the config nodes of modbus and serial
As when I connect one the other onedon’t work/can’t connect as the port is being used by the other config node. I use serial to write and modbus to read.
An example of the error I see when I try to to enable my serial node it shows connected but gives me this error as its config node can’t work as it says the port is being used when modbus config node is connected thus it can read my sensors data.
Also when serial can write data as it config node is connected. Modbus config node can’t connect .