# Encoding 4-byte signed value

**URL:** https://discourse.nodered.org/t/encoding-4-byte-signed-value/4720
**Category:** General
**Created:** [9 November 2018 11:50 UTC](https://discourse.nodered.org/t/encoding-4-byte-signed-value/4720 "2018-11-09T11:50:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![aabbas](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@aabbas](https://discourse.nodered.org/u/aabbas)
#### Post date: [9 November 2018 11:50 UTC](https://discourse.nodered.org/t/encoding-4-byte-signed-value/4720/1 "2018-11-09T11:50:39Z")

</div>

Hi, I have a KNX Energy saver and I am using Node-RED to visualize the consumption. The type of msg.payload is 4-byte signed value.

" 09/11/2018 à 12:43:50[node: 3156fe23.2366e2](http://192.168.7.109:1880/#)knx: write : msg.payload : Object

object

srcphy: "3.1.8"

dstgad: "7/6/5"

value: buffer[4][raw](http://192.168.7.109:1880/#)

0: 0x0

1: 0x0

2: 0x0

3: 0x33  
"  
I want to convert the buffer in decimal value.

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b9e65b37b06f9a0f3a140846625ef16f17fd0524.png) Thank you for your help.

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [9 November 2018 12:36 UTC](https://discourse.nodered.org/t/encoding-4-byte-signed-value/4720/2 "2018-11-09T12:36:27Z")

</div>

did the answer you were given last time you asked this question not work?

> [@How can I convert a buffer \[4\] into a number value?](https://discourse.nodered.org/t/how-can-i-convert-a-buffer-4-into-a-number-value/3506/2):
>
> Here is a nice reference for [reading/writing buffers](https://www.w3schools.com/nodejs/ref_buffer.asp) 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;

---

<div class="post-metadata">

### Author: ![aabbas](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@aabbas](https://discourse.nodered.org/u/aabbas)
#### Post date: [13 November 2018 11:41 UTC](https://discourse.nodered.org/t/encoding-4-byte-signed-value/4720/3 "2018-11-13T11:41:07Z")

</div>

I obtain the right values. Thank you
