I'm working on a project whereby I'm using a IOT gateway monitoring multiple systems / sensors that runs an instance of Node-Red.
I'm pulling data back and exposing point values via ModbusTCP (using [node-red-contrib-modbus) to a 3rd party modbus master, but I need to write said data to multiple modbus slaves.
Using the flex write node and have the following code from 2 different functions attempting to write to 2 different slaves. But it seems the flex write is writing to both slaves despite the "unitid" being different in each function?
Does anyone know where I'm going wrong?
var coil = msg.payload;
msg.payload = {
'value': coil,
'fc': 5,
'unitid': 1,
'address': 1,
'quantity': 1
}
return msg
and
var coil = msg.payload;
msg.payload = {
'value': coil,
'fc': 5,
'unitid': 2,
'address': 1,
'quantity': 1
}
return msg