I want to extract the value read on the channel A sensor (Bytes 3, 4 and 5) and convert into a decimal value as explains in the example (in my case the type os sensor is 0-10V).
This is an example of payload I'm receiving: "4200012d6d2400000000"
Right, that was worth asking because it is not a string but a buffer. The next issue is that the table you showed has 11 bytes, whereas yours only has 10, has the first byte has already been dropped off? If so then it is actually bytes 2, 3 4 that you want, Is that correct?
The second byte is 0x42 in the table also, whereas yours is not, so that didn't help. However you want bytes 3,4,5 from a buffer. You can use something like var value = buffer.readUIntBE(3, 3);
or var value = buffer.readUIntLE(3, 3);
dependent on whether your processor is little endian or big endian. You haven't said what h/w you are running on so I don't know. Try them both and see which gives the right answer.
If you're on a Conduit, you are probably on quite an old version of Node.js - which will explain why the readUIntBE method isn't recognised. I don't believe you can easily upgrade either.
You also need to return a message object from the function, rather than a raw value.
The Multitech Conduit runs an old version of node.js and can't easily be upgraded - so you may need to use older versions of any calls - eg - https://nodejs.org/docs/latest-v0.10.x/api/buffer.html
Maybe you mean readUInt32BE or one of the many variants...