I'm trying to convert the array that the modbus receiver keep from the IEM3350
I have some problem:
when I put this function that I've found on a YouTube video from an official schneider tutorial, it doesn't work:
const buf = Buffer.from(msg.responseBuffer.buffer); const value = buf.readFloatBE(); msg.payload = value; return msg;
Then, I tried with another function that I founded on the web; sometimes works...:
let pay = msg.payload; const buf = Buffer.allocUnsafe(4); buf.writeUInt16BE(pay,2); buf.writeUInt16BE(pay,0); msg.payload = buf.readFloatBE(0); return msg;
...but sometimes give me this error:
"RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -32768 and <= 32767. Received 45267"
Have you the same problem?
Someone solved it?