# Need help decoding these packets

**URL:** <https://discourse.nodered.org/t/need-help-decoding-these-packets/49973>\
**Category:** General\
**Created:** [21 August 2021 00:25 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973 "2021-08-21T00:25:40Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [21 August 2021 00:25 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/1 "2021-08-21T00:25:40Z")

</div>

Guys,

Just in the middle of commissioning our new Battery system and trying to work out the information being returned by the inverter.

At this stage there is little/no data on the internet regarding this inverter and the info it returns so i am having to reverse engineer it.

It is a Goodwe SBP5000 A/C coupled inverter

Basically we send a UDP request packet to it and it returns a whole heap of hex data - i need to take all of that data and convert it on the fly to decimal assuming it is 16 bit and then do the same to 32 bit  
Hopefully i will then be able to start comparing the return values to what is showing the in woeful app and work out what each one relates to

So here is a screenshot for instance of the output of the debug node

I have up to now just been putting in two of the return values into the calculator as Hex and converting to decimal but that is proving to be too slow to be practical - any ideas ?

Craig

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/4587dc3be5dad5a303238a439a487613823389e7.png)

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [21 August 2021 00:46 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/2 "2021-08-21T00:46:10Z")

</div>

Check out @Steve-Mcl 's **Buffer-Parser**.. its the right tool for the right job

> **[node-red-contrib-buffer-parser](https://flows.nodered.org/node/node-red-contrib-buffer-parser)**
>
> Node-red nodes to convert values to and from buffer/array. Supports Big/Little Endian, BCD, byte swapping and much more

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [21 August 2021 00:51 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/3 "2021-08-21T00:51:21Z")

</div>

Excellent will do thanks

Dont know why i did not think of that myself - not enough sleep playing with the new toys !

Craig

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 August 2021 06:45 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/4 "2021-08-21T06:45:59Z")

</div>

I suggest you try converting the buffer to a string.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 August 2021 09:14 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/5 "2021-08-22T09:14:20Z")

</div>

Yep good call - turns out it was a generic response with IP address and a Model number.

Working through other permutations now !

Craig

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [27 August 2021 05:07 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/6 "2021-08-27T05:07:13Z")

</div>

OK guys not quite solved - can someone tell me how to get the whole Hex stream of digits that is returned ?

Here is the debug window in NR

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/b/3bad4ede8d92852b92b28778a0e46aa9c10d8a0c.png)

And here it is as a string

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/3/d35ecae597a303e8f7dcb3f35a4587484ac1709b.png)

So i can see my text in there - but when in the debug i try to see all the hex bytes i get this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/4/f4d26e02af407c6644c2a7a9e7d213181bb248cd.png)

Is there a way to just spit them out as a Hex string so i can step through them looking for patterns - i.e. one big long 86 digit Hex string ?

Craig

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 August 2021 06:35 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/7 "2021-08-27T06:35:21Z")

</div>

`let str = msg.payload.toString()`

Not at my computer, does the UDP node have an option to return a string rather than a buffer?

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [27 August 2021 06:55 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/8 "2021-08-27T06:55:57Z")

</div>

Yeah it does - let me try that thanks - will report back

Craig

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [27 August 2021 15:55 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/9 "2021-08-27T15:55:59Z")

</div>

Nope the UDP node when set to string mode just shows the ASCI representation for the characters it can intepret and glyphs for the rest.

What i am after is just a plain hex dump of each of the bytes so it would be say a 146 character string representing 73 Hex characters (zero padded where required)

Will trawl the net for some Javascript to do it and drop into a function node

Craig

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 August 2021 16:13 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/10 "2021-08-27T16:13:19Z")

</div>

Show us what it looks like, and what you want to get out of it.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [27 August 2021 16:18 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/11 "2021-08-27T16:18:17Z")

</div>

thanks Mate - here we go

So this is the debug window showing 86 bytes

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1017bab043d65495e9a09d94c8914ee04358344.png)

This is if i click on it to turn it into a string rather than bytes

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/32f09c11fe6cd19e7dd174630b716f7cd8c7f2c0.png)

And if i leave it as bytes and open it up

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e7d30d334b395a21f5ef91cb242d856d909c8da.png)

Whereas what i need to see to try and identify the patterns so i can feed it in the buffer parser (the registers are unknown and undocumented at this stage) is

aa557fc001824d3038 etc etc

Craig

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 August 2021 16:30 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/12 "2021-08-27T16:30:30Z")

</div>

function like `msg.payload=msg.payload.toString("hex")` may help

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [27 August 2021 16:33 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/13 "2021-08-27T16:33:22Z")

</div>

> [@dceejay](#):
>
> msg.payload=msg.payload.toString("hex")

Thats it thanks - why do i always look for the hard way to do things ??

Craig

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 September 2021 16:34 UTC](https://discourse.nodered.org/t/need-help-decoding-these-packets/49973/14 "2021-09-10T16:34:04Z")

</div>

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