0

I am a beginner with Node-Red and I would like to read the data of a meter via modbus and then display it in float format

enter image description here

With Modbus-Read node I'm getting this data:

enter image description here

How can I to convert in a float number like 407.555

thanks in advance for the help

Update 06/11/2021: I'tryng to convert the array recived from modbus but the result is wrong. I try tu use a function like this:

let pay = msg.payload;
const buf = Buffer.allocUnsafe(4);

buf.writeInt16BE(pay[0],2);
buf.writeInt16BE(pay[1],0);

msg.payload = buf.readFloatBE(0);
return msg;

In NodeRed if I add a debug I can read 0x1f85 0xb40

so is the same reading using a different modbus reader but the conversion in nodered with the function is 3.700156759202689e-32 and the value right is 2.18

MadCat
  • 113
  • 1
  • 1
  • 13
  • https://stackoverflow.com/questions/66391528/value-is-out-of-bound-node-red-reading-float – hardillb Jun 08 '21 at 21:49
  • @MadCat can you update your question to be a bit more specific? do you mean you want to convert the array of data values read from modbus to float? or is the meter providing float values, but node-red-contrib-modbus is not converting data properly? – Nicholas.V Jun 09 '21 at 19:49
  • 1
    https://stackoverflow.com/questions/56257673/reading-32-bit-float-from-modbus-tcp-using-node-red – Nicholas.V Jun 09 '21 at 20:08
  • @Nicolas.V thankyou for your reply I try to add some more information – MadCat Jun 11 '21 at 16:46

0 Answers0