Hi Igloodan,
yes .. msg.payload is replaced by the Modbus Flex Getter node with the modbus register values reply .. and unfortunatelly the node doesnt keep the properties of the original msg ..
but i believe you can preserve the original payload (or any other properties) with the following example.
Consider having a simple read
In the Function node you can pass in value
all the data that you want to preserve.
msg.payload = {
'value': {originalPayload: msg.payload, myKey: "test"},
'fc': 4,
'unitid': 1,
'address': 0,
'quantity': 120
}
return msg;
That you can later pickup from msg.modbusRequest.value
Test Flow:
[{"id":"d7423fb4.625788","type":"function","z":"981a2a72.4329f","name":"FC4","func":"msg.payload = { \n \n 'value': {originalPayload: msg.payload, myKey: \"test\"},\n 'fc': 4,\n 'unitid': 1,\n 'address': 0,\n 'quantity': 120\n \n} \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":940,"wires":[["5f36b457.bc277c"]]},{"id":"5f36b457.bc277c","type":"modbus-flex-getter","z":"981a2a72.4329f","name":"","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"bf37180a.2d18e","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":560,"y":940,"wires":[["19f8c57d.a690e3"],[]]},{"id":"6b38e4c3.61cac4","type":"inject","z":"981a2a72.4329f","name":"trigger","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temperatures","payload":"","payloadType":"date","x":140,"y":940,"wires":[["d7423fb4.625788"]]},{"id":"19f8c57d.a690e3","type":"debug","z":"981a2a72.4329f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":940,"wires":[]},{"id":"bf37180a.2d18e","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.1.66","tcpPort":"502","tcpType":"TPC-RTU-BUFFERED","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":20,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}]