Schneider modbus Float32 IEM3350

Hi all,

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);

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?


Many have.

Do your self a favour and use node-red-contrib-buffer-parser it takes care of all the details.

There are quite a few threads that do this - take a look in particular this one and this one and this one

Thanks for your support,
This module seems very interesting.
Anyway, I've found this function on the web and it's working good...

var ui16 = new Uint16Array(msg.payload);
var fl32 = new Float32Array(ui16.buffer, ui16.byteOffset, ui16.byteLength / Float32Array.BYTES_PER_ELEMENT);
msg.payload= fl32;
return msg;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.