Modbus and Serial IN/OUT nodes (both) use one serial port

Hello community.
I have one device connected to serial port of device where Node-red runs (for instance - USB/RS485 converter connected to COM3). But, in Node-red flow, I have Modbus-Flex-Getter node and Serial IN/OUT nodes. Both use same port COM3. When some event has been occured (for instance I got the message from MQTT or HTTP) Modbus-Flex-Getter node should be "activated" and communication with COM3 in Serial IN/OUT nodes shoud be closed. When some other event has been occured - Modbus communication should be closed and communication via Serial IN/OUT node will be restored.

In other words. I have one global bool variable. State of that variable will decide what node (Modbus or Serial IN/OUT) uses COM3.

Any ideas how to solve this issue?

I know one possible solution on this issue - just replace Modbus-Flex-Getter node with usual function where Modbus frame is created manually. And use only Serial IN/OUT nodes. But, in such case, there are a lot of hardcoding...

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