# Buffer parser of Modbus data

**URL:** <https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609>\
**Category:** General\
**Created:** [18 July 2024 21:16 UTC](https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609 "2024-07-18T21:16:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jttjtt](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jttjtt](https://discourse.nodered.org/u/jttjtt)\
**Post date:** [18 July 2024 21:16 UTC](https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609/1 "2024-07-18T21:16:34Z")

</div>

I am reading data from Solar inverter using MODBUS-Getter node. Then I am parsing the output with bufer-parser node.

For example for the first values defined in modbus like:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/1642bfe66f59e294e70ddae6d707f189537bae18.png)

I have set the parser like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/05aa16a5cc50a5be5c2d212edef153638dd50b4c.png)

This works fine.  
But when I come to this part, where I need to read two registers:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bfefa00344d523031a5d3e95b31f8cc40132ba9b.png)

I tried to set it up like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/957f8f2ca311728db6b86d6baa976d5e88579b1c.png)

But it is giving me two numbers:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f86bff07917def812d2d062d9bd96177376da83.png)

I am doing something wrong. Can you pls advise me what to change? Thanks.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 July 2024 22:31 UTC](https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609/2 "2024-07-18T22:31:29Z")

</div>

> [@jttjtt](#):
>
> I tried to set it up like this:
> 
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/957f8f2ca311728db6b86d6baa976d5e88579b1c.png)
> 
> But it is giving me two numbers:  
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f86bff07917def812d2d062d9bd96177376da83.png)
> 
> I am doing something wrong

You asked for 2 when you set the length to 2 & it gave you 2.

The built in help states:

**length** The quantity of items to be returned. e.g. 6 bools or 12 floats or 34 int32s. NOTE: setting length to -1 will attempt to read all bytes from offset to the end. NOTE: If source data does not have enough bytes, the operation will fail

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

---

<div class="post-metadata">

**Author:** ![jttjtt](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jttjtt](https://discourse.nodered.org/u/jttjtt)\
**Post date:** [18 July 2024 22:45 UTC](https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609/3 "2024-07-18T22:45:11Z")

</div>

I have tried with the "-1", but the problem is, that there are many more fields "to the end"...  
I have tried also only two read the two registers with modbus and send them to the buffer parser, but still was unable to get the right Power...

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 July 2024 23:20 UTC](https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609/4 "2024-07-18T23:20:39Z")

</div>

You misunderstand. If you want 1 item, enter 1 for the length.

> [@Steve-Mcl](#):
>
> **length** The quantity of items to be returned

---

<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:** [16 October 2024 23:20 UTC](https://discourse.nodered.org/t/buffer-parser-of-modbus-data/89609/5 "2024-10-16T23:20:53Z")

</div>

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