How can I convert a buffer [4] into a number value?

#1

Hello,
I have KES - KNX Energy Saver - REF: ZN1IO-KES. I like to get the energy consumption on my node red-dashboad. But i have problem with it. I got this message on my debug window ( knx: write : msg.payload : Object

object

srcphy: "3.1.55"

dstgad: "11/7/20"

value: buffer[4][raw]

0: 0x0

1: 0x0

2: 0x0

3: 0x0 )
How can I convert a buffer [4] into a number value?

0 Likes

#2

Here is a nice reference for reading/writing buffers on the W3Schools site.

For instance, if you just want to replace the 4-byte payload buffer with its 32-bit signed
big-endian integer value, try this:

msg.payload = msg.payload.readInt32BE();
return msg;
0 Likes

Encoding 4-byte signed value