That can get tricky. While the flex-getter and flex-write nodes both have internal message queues, they don't interface with each other to make the queues sequential between the two of them. If a write sends a message while a read is still processing, it could collide and cause an error where neither the write or read complete.
There is a node called node-red-contrib-simple-message-queue that has helped with mine and other's MODBUS implementations in the past. You'll make a setup like this when you use it:
Whatever is currently sending a message to a MODBUS node will instead send it to the simple queue. This includes reads and writes. You will want to setup some kind of flag in the messsages to distinguish what they are (read or write), like setting msg.topic = "read" or something. Configure the simple queue to send the first message through so that the process can start normally.
Once the messages start entering the queue, the queue will send them one at a time through the diverter function. This is where you'll figure out if they're a read or write and send them to the appropriate node.
if(msg.topic == "read"){
return([msg,null]);
}
if(msg.topic == "write"){
return([null,msg]);
}
The message will process on the MODBUS channel depending on if it's a read or write. When that is done, it will send the return to the trigger sender. The main purpose of this function is to send the {trigger:true} property back to the simple queue to send the next available message through. You can use this function as well to do any post message processing or diverting if necessary, such as discarding any results from the write messages so they don't mess up the nodes down the line (which I would recommend). But the main function is to send the message back to the simple queue. In all its simplicity, this is the least you would need it to hold:
return([{trigger:true}, msg]);
Adding discarding write results would look like this:
if(msg.topic == "write"){
return([{trigger:true}, null]);
}
if(msg.topic == "read"){
return([{trigger:true}, msg]);
}
This will ensure that no matter when messages are sent to the MODBUS channel, whether they're read or write, they won't hit the channel at the same time because you have a gatekeeper watching to make sure something goes out the other side before something else enters.
Hopefully that helps any future problems before they happen. Glad it's working for you!