I have multiple Modbus variables that I am trying to store on my local disk.
My function script is as follows:
var msgPortBus,msgStbdBus;
if (msg.topic === 'BusVolts') {
msgPortBus = { payload: msg.payload.Port.Bus.Volts, };
msgStbdBus = { payload: msg.payload.STBD.Bus.Volts, };
}
msg.payload = [msgPortBus,msgStbdBus]
return msg;
I assume the error is in the code above somewhere.... The topics for both Modbus nodes are 'BusVolts'.
I had used the following code for one input, which gives me my timestamp and then the data I would like from one input, but I was not sure how to differentiate between different payloads.
msg.payload = new Date().toString() +
"," + msg.payload;
return msg;
Thanks in advance.
EDIT: Error is "Type Error: Cannot read property 'Bus' of undefined"