# Adding two values

**URL:** <https://discourse.nodered.org/t/adding-two-values/32784>\
**Category:** General\
**Created:** [12 September 2020 16:32 UTC](https://discourse.nodered.org/t/adding-two-values/32784 "2020-09-12T16:32:29Z")\
**Posts on this page:** 20\
**Page:** 3

<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:** [26 September 2020 10:50 UTC](https://discourse.nodered.org/t/adding-two-values/32784/41 "2020-09-26T10:50:18Z")

</div>

@Becker, do you want my help or not? I have better things to do mate.

1. get me some data to play with...  

2. copy the values using the COPY button in the DEBUG output...  
 ![Vmz3Zy8Buu](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/392acfb68c5a638f774f86fda6d22fb96f0bab5f.gif)

3. Paste the results in your reply  
`````  
`like this`  
`````

4. tell me what the values SHOULD be

---

<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:** [26 September 2020 11:26 UTC](https://discourse.nodered.org/t/adding-two-values/32784/42 "2020-09-26T11:26:07Z")

</div>

Becker .. we see that you have your debug nodes set to show only the msg.payload  
In case you missed that detail .. a debug node can be set to show complete msg

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

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [26 September 2020 11:54 UTC](https://discourse.nodered.org/t/adding-two-values/32784/43 "2020-09-26T11:54:51Z")

</div>

ah, didn´t know, sorry.

```auto
{"topic":"df8249b3.d3713","messageId":"5f6f2b6d4a6d37a91c8168c7","payload":[0,1450,0,1437,0,477,0,475,0,485,0,23102,0,23162,0,23264,0,40102,0,40124,0,40188,0,6355,65535,65535,65535,65535,65535,65535,0,5000,32768,0,65535,65441,65535,65435,65535,65440,0,1466,0,489,0,488,0,497,65535,65535,255,65533,255,65533,0,0,0,0,32768,0,255,65533,0,1079,0,6000,0,100,65535,65535,32768,0,65535,65535,65535,65535,32768,0,65535,65535,255,65533,65535,65535,32768,0,255,65533,32768,0,65535,65535,0,0,0,1697],"queueLengthByUnitId":{"unitId":3,"queueLength":0},"queueUnitId":3,"unitId":3,"modbusRequest":{"value":1601121133656,"unitid":"","fc":4,"address":"30773","quantity":"96","messageId":"5f6f2b6d4a6d37a91c8168c7"},"responseBuffer":{"data":[0,1450,0,1437,0,477,0,475,0,485,0,23102,0,23162,0,23264,0,40102,0,40124,0,40188,0,6355,65535,65535,65535,65535,65535,65535,0,5000,32768,0,65535,65441,65535,65435,65535,65440,0,1466,0,489,0,488,0,497,65535,65535,255,65533,255,65533,0,0,0,0,32768,0,255,65533,0,1079,0,6000,0,100,65535,65535,32768,0,65535,65535,65535,65535,32768,0,65535,65535,255,65533,65535,65535,32768,0,255,65533,32768,0,65535,65535,0,0,0,1697],"buffer":[0,0,5,170,0,0,5,157,0,0,1,221,0,0,1,219,0,0,1,229,0,0,90,62,0,0,90,122,0,0,90,224,0,0,156,166,0,0,156,188,0,0,156,252,0,0,24,211,255,255,255,255,255,255,255,255,255,255,255,255,0,0,19,136,128,0,0,0,255,255,255,161,255,255,255,155,255,255,255,160,0,0,5,186,0,0,1,233,0,0,1,232,0,0,1,241,255,255,255,255,0,255,255,253,0,255,255,253,0,0,0,0,0,0,0,0,128,0,0,0,0,255,255,253,0,0,4,55,0,0,23,112,0,0,0,100,255,255,255,255,128,0,0,0,255,255,255,255,255,255,255,255,128,0,0,0,255,255,255,255,0,255,255,253,255,255,255,255,128,0,0,0,0,255,255,253,128,0,0,0,255,255,255,255,0,0,0,0,0,0,6,161]},"_msgid":"69b494d7.52af2c"}

```

```auto
{"PDC2":95027200,"PAC2":94175232,"Pbez":0,"Pein":111214592}

```

```auto
{"topic":"5909172b.d6bb18","messageId":"5f6f2b6d4a6d37a91c8168c8","payload":[0,364],"queueLengthByUnitId":{"unitId":3,"queueLength":1},"queueUnitId":3,"unitId":3,"modbusRequest":{"value":1601121133656,"unitid":"","fc":4,"address":"30953","quantity":"2","messageId":"5f6f2b6d4a6d37a91c8168c8"},"responseBuffer":{"data":[0,364],"buffer":[0,0,1,108]},"_msgid":"251472d0.ce518e"}

```

```auto
{"T2":23855104}

```

```auto
{"topic":"5f9e2884.d556c8","messageId":"5f6f2b6d4a6d37a91c8168c9","payload":[0,23354,0,23378,0,23541],"queueLengthByUnitId":{"unitId":3,"queueLength":2},"queueUnitId":3,"unitId":3,"modbusRequest":{"value":1601121133656,"unitid":"","fc":4,"address":"31253","quantity":"6","messageId":"5f6f2b6d4a6d37a91c8168c9"},"responseBuffer":{"data":[0,23354,0,23378,0,23541],"buffer":[0,0,91,58,0,0,91,82,0,0,91,245]},"_msgid":"4b84a5f0.bf6a0c"}

```

```auto
{"UL1":1530527744,"UL2":1532100608,"UL3":1542782976}

```

```auto
{"topic":"b256ea3f.ead7c","messageId":"5f6f2b6d4a6d37a91c8168ca","payload":[0,4999,65535,65535,65535,65535,65535,65535,0,1875,65535,65535,65535,65535,32768,0,32768,0,65535,65535,65535,65535,255,65533,255,65533,32768,0,32768,0,65535,65535,65535,65535,0,0,0,0,255,65533,255,65533,255,65533,255,65533,255,65533,255,65533,65535,65244],"queueLengthByUnitId":{"unitId":3,"queueLength":3},"queueUnitId":3,"unitId":3,"modbusRequest":{"value":1601121133656,"unitid":"","fc":4,"address":"31447","quantity":"52","messageId":"5f6f2b6d4a6d37a91c8168ca"},"responseBuffer":{"data":[0,4999,65535,65535,65535,65535,65535,65535,0,1875,65535,65535,65535,65535,32768,0,32768,0,65535,65535,65535,65535,255,65533,255,65533,32768,0,32768,0,65535,65535,65535,65535,0,0,0,0,255,65533,255,65533,255,65533,255,65533,255,65533,255,65533,65535,65244],"buffer":[0,0,19,135,255,255,255,255,255,255,255,255,255,255,255,255,0,0,7,83,255,255,255,255,255,255,255,255,128,0,0,0,128,0,0,0,255,255,255,255,255,255,255,255,0,255,255,253,0,255,255,253,128,0,0,0,128,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,253,0,255,255,253,0,255,255,253,0,255,255,253,0,255,255,253,0,255,255,253,255,255,254,220]},"_msgid":"a5a6c72b.80cb98"}

```

```auto
{"Hz":327614464,"var":-33619840}

```

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

I hope I made it right now 🥺

Hz should be 49,95 - 50,05  
T2 should be 36°C  
PDC2 1500-2000W  
PAC2 same

---

<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:** [26 September 2020 12:27 UTC](https://discourse.nodered.org/t/adding-two-values/32784/44 "2020-09-26T12:27:12Z")

</div>

~~Ok, now can you post a link to your manual that lists register 31447 as HZ value.~~

Never mind, found it.

So, in your linked doc...

`Metering.GridMs.Hz 31447 2 U32 FIX2`

it says 31447 Hz is U32 Unsigned Int 32. however, it then says FIX2 suggesting its a float.

---

<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:** [26 September 2020 12:41 UTC](https://discourse.nodered.org/t/adding-two-values/32784/45 "2020-09-26T12:41:42Z")

</div>

> [@Steve-Mcl](#):
>
> however, it then says FIX2 suggesting its a float

its read as an int and then it needs to be divided by 100 ?

[OFF TOPIC] that would a nice feature for buffer parser to do a 'scaling' on the value for these cases

---

<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:** [26 September 2020 12:44 UTC](https://discourse.nodered.org/t/adding-two-values/32784/46 "2020-09-26T12:44:18Z")

</div>

> [@UnborN](#):
>
> its read as an int and then it needs to be divided by 100 ?

Same here.

> [@UnborN](#):
>
> [OFF TOPIC] that would a nice feature for buffer parser to do a 'scaling' on the value for these cases

[Waaaaay ahead](https://github.com/Steve-Mcl/node-red-contrib-buffer-parser/issues/1) of ya 😉

---

<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:** [26 September 2020 13:29 UTC](https://discourse.nodered.org/t/adding-two-values/32784/48 "2020-09-26T13:29:10Z")

</div>

So the settings you need in the buffer parser are `NO SWAP` and use the `BIG ENDIAN` (be) functions...

> [@Becker](#):
>
> Hz should be 49,95 - 50,05  
> T2 should be 36°C  
> PDC2 1500-2000W  
> PAC2 same

Yes, yes, and yes...

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

```auto
[{"id":"dba0f9a0.21afa8","type":"inject","z":"a605bf7e.09445","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":360,"wires":[["6eb5eb5c.6984c4","b4c957d.a86dba8","47286846.5b20c8","c938e90a.ef2b38"]]},{"id":"6eb5eb5c.6984c4","type":"modbus-getter","z":"a605bf7e.09445","name":"30773 ~ 30869","showStatusActivities":false,"showErrors":true,"logIOActivities":false,"unitid":"","dataType":"InputRegister","adr":"30773","quantity":"96","server":"7b9a0315.71ca9c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":400,"y":280,"wires":[["c49c1095.5511b","841e26c7.739b58"],[]]},{"id":"b4c957d.a86dba8","type":"modbus-getter","z":"a605bf7e.09445","name":"30953 ~ 30955","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"InputRegister","adr":"30953","quantity":"2","server":"7b9a0315.71ca9c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":400,"y":360,"wires":[["5db7c6a0.c8bbe8","929cd654.324a78"],[]]},{"id":"47286846.5b20c8","type":"modbus-getter","z":"a605bf7e.09445","name":"31253 ~ 31259","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"InputRegister","adr":"31253","quantity":"6","server":"7b9a0315.71ca9c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":400,"y":440,"wires":[["c57020b8.f203f","e3a62aee.437e18"],[]]},{"id":"c938e90a.ef2b38","type":"modbus-getter","z":"a605bf7e.09445","name":"31447 ~ 31499","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"InputRegister","adr":"31447","quantity":"52","server":"7b9a0315.71ca9c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":400,"y":520,"wires":[["1cbe3f09.d66c41","94e91a35.a25ff8"],[]]},{"id":"c49c1095.5511b","type":"buffer-parser","z":"a605bf7e.09445","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32be","name":"PDC2","offset":0,"length":1,"offsetbit":0,"mask":""},{"type":"int32be","name":"PAC2","offset":4,"length":1,"offsetbit":0,"mask":""},{"type":"int32be","name":"Pbez","offset":184,"length":1,"offsetbit":0,"mask":""},{"type":"int32be","name":"Pein","offset":188,"length":1,"offsetbit":0,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":590,"y":280,"wires":[["2dc6cfe8.e3b2a","e5a74da9.d9a4a","937504b6.9650e8","daf78158.70ee9","1b3a46a6.569529"]]},{"id":"5db7c6a0.c8bbe8","type":"buffer-parser","z":"a605bf7e.09445","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32be","name":"T2","offset":0,"length":1,"offsetbit":0,"mask":""}],"swap1":"","swap2":"swap16","swap3":"swap32","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":590,"y":360,"wires":[["da8c3c36.a8aa1","bdc43ef9.2684c"]]},{"id":"c57020b8.f203f","type":"buffer-parser","z":"a605bf7e.09445","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32le","name":"UL1","offset":0,"length":1,"offsetbit":0,"mask":""},{"type":"int32le","name":"UL2","offset":4,"length":1,"offsetbit":0,"mask":""},{"type":"int32le","name":"UL3","offset":8,"length":1,"offsetbit":0,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":590,"y":440,"wires":[["5d151875.5d3d48","b3c044a6.6e6458","436f3d5c.30be54","f4b04c08.49eb1"]]},{"id":"1cbe3f09.d66c41","type":"buffer-parser","z":"a605bf7e.09445","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint32be","name":"Hz","offset":0,"length":1,"offsetbit":0,"mask":""},{"type":"int32be","name":"var","offset":100,"length":1,"offsetbit":0,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":590,"y":520,"wires":[["b7049802.006068","63c9e641.965d88","d6bac605.18e9a8"]]},{"id":"2dc6cfe8.e3b2a","type":"debug","z":"a605bf7e.09445","name":"parser1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":120,"wires":[]},{"id":"e5a74da9.d9a4a","type":"ui_text","z":"a605bf7e.09445","group":"8a11e8c7.342528","order":1,"width":0,"height":0,"name":"P-ein","label":"<font color=green> Leistung Einspeisung","format":"{{msg.payload.Pein}} W","layout":"row-spread","x":830,"y":160,"wires":[]},{"id":"937504b6.9650e8","type":"ui_text","z":"a605bf7e.09445","group":"8a11e8c7.342528","order":2,"width":0,"height":0,"name":"P-bez","label":"<font color=red> Leistung Bezug","format":"{{msg.payload.Pbez}} W","layout":"row-spread","x":830,"y":200,"wires":[]},{"id":"daf78158.70ee9","type":"ui_text","z":"a605bf7e.09445","group":"5be273cb.ceaddc","order":1,"width":0,"height":0,"name":"P-AC2","label":"Leistung AC","format":"{{msg.payload.PAC2}} W","layout":"row-spread","x":830,"y":240,"wires":[]},{"id":"1b3a46a6.569529","type":"ui_text","z":"a605bf7e.09445","group":"5be273cb.ceaddc","order":2,"width":0,"height":0,"name":"P-DC2","label":"<font color=orange> Leistung DC","format":"{{msg.payload.PDC2}} W","layout":"row-spread","x":830,"y":280,"wires":[]},{"id":"da8c3c36.a8aa1","type":"ui_text","z":"a605bf7e.09445","group":"5be273cb.ceaddc","order":3,"width":0,"height":0,"name":"T2","label":"Temperatur","format":"{{msg.payload.T2}} °C","layout":"row-spread","x":830,"y":380,"wires":[]},{"id":"bdc43ef9.2684c","type":"debug","z":"a605bf7e.09445","name":"parser2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":340,"wires":[]},{"id":"5d151875.5d3d48","type":"ui_text","z":"a605bf7e.09445","group":"8a11e8c7.342528","order":3,"width":0,"height":0,"name":"U-L1","label":"Spannung L1","format":"{{msg.payload.UL1}} V","layout":"row-spread","x":830,"y":480,"wires":[]},{"id":"b3c044a6.6e6458","type":"ui_text","z":"a605bf7e.09445","group":"8a11e8c7.342528","order":4,"width":0,"height":0,"name":"U-L2","label":"Spannung L2","format":"{{msg.payload.UL2}} V","layout":"row-spread","x":830,"y":520,"wires":[]},{"id":"436f3d5c.30be54","type":"ui_text","z":"a605bf7e.09445","group":"8a11e8c7.342528","order":5,"width":0,"height":0,"name":"U-L3","label":"Spannung L3","format":"{{msg.payload.UL3}} V","layout":"row-spread","x":830,"y":560,"wires":[]},{"id":"f4b04c08.49eb1","type":"debug","z":"a605bf7e.09445","name":"parser3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":440,"wires":[]},{"id":"b7049802.006068","type":"ui_text","z":"a605bf7e.09445","group":"8a11e8c7.342528","order":6,"width":0,"height":0,"name":"Hz","label":"Frequenz","format":"{{msg.payload}} Hz","layout":"row-spread","x":830,"y":660,"wires":[]},{"id":"63c9e641.965d88","type":"ui_text","z":"a605bf7e.09445","group":"5be273cb.ceaddc","order":3,"width":0,"height":0,"name":"var","label":"Blindleistung","format":"{{msg.payload}} var","layout":"row-spread","x":830,"y":700,"wires":[]},{"id":"d6bac605.18e9a8","type":"debug","z":"a605bf7e.09445","name":"parser4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":620,"wires":[]},{"id":"737d118c.a9597","type":"comment","z":"a605bf7e.09445","name":"STP6.0-3AV-40","info":"","x":140,"y":320,"wires":[]},{"id":"f6b1a0c2.05d6a","type":"inject","z":"a605bf7e.09445","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":355,"y":240,"wires":[["e7e75d67.fa569"]],"l":false},{"id":"e7e75d67.fa569","type":"function","z":"a605bf7e.09445","name":"fake it","func":"\nreturn { \"topic\": \"df8249b3.d3713\", \n\"messageId\": \"5f6f2b6d4a6d37a91c8168c7\", \n\"payload\": [0, 1450, 0, 1437, 0, 477, 0, 475, 0, 485, 0, 23102, 0, 23162, 0, 23264, 0, 40102, 0, 40124, 0, 40188, 0, 6355, 65535, 65535, 65535, 65535, 65535, 65535, 0, 5000, 32768, 0, 65535, 65441, 65535, 65435, 65535, 65440, 0, 1466, 0, 489, 0, 488, 0, 497, 65535, 65535, 255, 65533, 255, 65533, 0, 0, 0, 0, 32768, 0, 255, 65533, 0, 1079, 0, 6000, 0, 100, 65535, 65535, 32768, 0, 65535, 65535, 65535, 65535, 32768, 0, 65535, 65535, 255, 65533, 65535, 65535, 32768, 0, 255, 65533, 32768, 0, 65535, 65535, 0, 0, 0, 1697], \"queueLengthByUnitId\": { \"unitId\": 3, \"queueLength\": 0 }, \"queueUnitId\": 3, \"unitId\": 3, \"modbusRequest\": { \"value\": 1601121133656, \"unitid\": \"\", \"fc\": 4, \"address\": \"30773\", \"quantity\": \"96\", \"messageId\": \"5f6f2b6d4a6d37a91c8168c7\" }, \"responseBuffer\": { \"data\": [0, 1450, 0, 1437, 0, 477, 0, 475, 0, 485, 0, 23102, 0, 23162, 0, 23264, 0, 40102, 0, 40124, 0, 40188, 0, 6355, 65535, 65535, 65535, 65535, 65535, 65535, 0, 5000, 32768, 0, 65535, 65441, 65535, 65435, 65535, 65440, 0, 1466, 0, 489, 0, 488, 0, 497, 65535, 65535, 255, 65533, 255, 65533, 0, 0, 0, 0, 32768, 0, 255, 65533, 0, 1079, 0, 6000, 0, 100, 65535, 65535, 32768, 0, 65535, 65535, 65535, 65535, 32768, 0, 65535, 65535, 255, 65533, 65535, 65535, 32768, 0, 255, 65533, 32768, 0, 65535, 65535, 0, 0, 0, 1697], \n\"buffer\": Buffer.from([0, 0, 5, 170, 0, 0, 5, 157, 0, 0, 1, 221, 0, 0, 1, 219, 0, 0, 1, 229, 0, 0, 90, 62, 0, 0, 90, 122, 0, 0, 90, 224, 0, 0, 156, 166, 0, 0, 156, 188, 0, 0, 156, 252, 0, 0, 24, 211, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 19, 136, 128, 0, 0, 0, 255, 255, 255, 161, 255, 255, 255, 155, 255, 255, 255, 160, 0, 0, 5, 186, 0, 0, 1, 233, 0, 0, 1, 232, 0, 0, 1, 241, 255, 255, 255, 255, 0, 255, 255, 253, 0, 255, 255, 253, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 255, 255, 253, 0, 0, 4, 55, 0, 0, 23, 112, 0, 0, 0, 100, 255, 255, 255, 255, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 128, 0, 0, 0, 255, 255, 255, 255, 0, 255, 255, 253, 255, 255, 255, 255, 128, 0, 0, 0, 0, 255, 255, 253, 128, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 6, 161]) }, \"_msgid\": \"69b494d7.52af2c\" };","outputs":1,"noerr":0,"x":430,"y":240,"wires":[["c49c1095.5511b","841e26c7.739b58"]]},{"id":"b55d4f3d.df621","type":"function","z":"a605bf7e.09445","name":"fake it","func":"\nvar m = {\"topic\":\"5909172b.d6bb18\",\"messageId\":\"5f6f2b6d4a6d37a91c8168c8\",\"payload\":[0,364],\"queueLengthByUnitId\":{\"unitId\":3,\"queueLength\":1},\"queueUnitId\":3,\"unitId\":3,\"modbusRequest\":{\"value\":1601121133656,\"unitid\":\"\",\"fc\":4,\"address\":\"30953\",\"quantity\":\"2\",\"messageId\":\"5f6f2b6d4a6d37a91c8168c8\"},\"responseBuffer\":{\"data\":[0,364],\"buffer\":[0,0,1,108]},\"_msgid\":\"251472d0.ce518e\"}\nm.responseBuffer.buffer = Buffer.from([0,0,1,108])\n\nreturn m;","outputs":1,"noerr":0,"x":430,"y":320,"wires":[["5db7c6a0.c8bbe8","929cd654.324a78"]]},{"id":"8c2e5572.2137c8","type":"inject","z":"a605bf7e.09445","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":355,"y":320,"wires":[["b55d4f3d.df621"]],"l":false},{"id":"83a41576.2a8328","type":"function","z":"a605bf7e.09445","name":"fake it","func":"\nvar m = { \"topic\": \"5f9e2884.d556c8\", \n\"messageId\": \"5f6f2b6d4a6d37a91c8168c9\", \n\"payload\": [0, 23354, 0, 23378, 0, 23541], \"queueLengthByUnitId\": { \"unitId\": 3, \"queueLength\": 2 }, \"queueUnitId\": 3, \"unitId\": 3, \"modbusRequest\": { \"value\": 1601121133656, \"unitid\": \"\", \"fc\": 4, \"address\": \"31253\", \"quantity\": \"6\", \"messageId\": \"5f6f2b6d4a6d37a91c8168c9\" }, \"responseBuffer\": { \"data\": [0, 23354, 0, 23378, 0, 23541], \"buffer\": Buffer.from([0, 0, 91, 58, 0, 0, 91, 82, 0, 0, 91, 245]) }, \"_msgid\": \"4b84a5f0.bf6a0c\" }\n\n\nreturn m;","outputs":1,"noerr":0,"x":430,"y":400,"wires":[["c57020b8.f203f","e3a62aee.437e18"]]},{"id":"c88edd8e.40a5f","type":"inject","z":"a605bf7e.09445","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":355,"y":400,"wires":[["83a41576.2a8328"]],"l":false},{"id":"459de81e.286c98","type":"function","z":"a605bf7e.09445","name":"fake it","func":"\n\n\n\n\nvar m = { \"topic\": \"b256ea3f.ead7c\", \n\"messageId\": \"5f6f2b6d4a6d37a91c8168ca\", \n\"payload\": [0, 4999, 65535, 65535, 65535, 65535, 65535, 65535, 0, 1875, 65535, 65535, 65535, 65535, 32768, 0, 32768, 0, 65535, 65535, 65535, 65535, 255, 65533, 255, 65533, 32768, 0, 32768, 0, 65535, 65535, 65535, 65535, 0, 0, 0, 0, 255, 65533, 255, 65533, 255, 65533, 255, 65533, 255, 65533, 255, 65533, 65535, 65244], \"queueLengthByUnitId\": { \"unitId\": 3, \"queueLength\": 3 }, \"queueUnitId\": 3, \"unitId\": 3, \"modbusRequest\": { \"value\": 1601121133656, \"unitid\": \"\", \"fc\": 4, \"address\": \"31447\", \"quantity\": \"52\", \"messageId\": \"5f6f2b6d4a6d37a91c8168ca\" }, \"responseBuffer\": { \"data\": [0, 4999, 65535, 65535, 65535, 65535, 65535, 65535, 0, 1875, 65535, 65535, 65535, 65535, 32768, 0, 32768, 0, 65535, 65535, 65535, 65535, 255, 65533, 255, 65533, 32768, 0, 32768, 0, 65535, 65535, 65535, 65535, 0, 0, 0, 0, 255, 65533, 255, 65533, 255, 65533, 255, 65533, 255, 65533, 255, 65533, 65535, 65244], \"buffer\": [0, 0, 19, 135, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 7, 83, 255, 255, 255, 255, 255, 255, 255, 255, 128, 0, 0, 0, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 253, 0, 255, 255, 253, 128, 0, 0, 0, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 255, 255, 254, 220] }, \"_msgid\": \"a5a6c72b.80cb98\" }\nm.responseBuffer.buffer = Buffer.from([0, 0, 19, 135, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 7, 83, 255, 255, 255, 255, 255, 255, 255, 255, 128, 0, 0, 0, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 253, 0, 255, 255, 253, 128, 0, 0, 0, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 0, 255, 255, 253, 255, 255, 254, 220])\n\nreturn m;","outputs":1,"noerr":0,"x":430,"y":480,"wires":[["1cbe3f09.d66c41","94e91a35.a25ff8"]]},{"id":"690f13c8.cfb26c","type":"inject","z":"a605bf7e.09445","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":355,"y":480,"wires":[["459de81e.286c98"]],"l":false},{"id":"94e91a35.a25ff8","type":"debug","z":"a605bf7e.09445","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":480,"wires":[]},{"id":"929cd654.324a78","type":"debug","z":"a605bf7e.09445","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":320,"wires":[]},{"id":"841e26c7.739b58","type":"debug","z":"a605bf7e.09445","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":240,"wires":[]},{"id":"e3a62aee.437e18","type":"debug","z":"a605bf7e.09445","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":400,"wires":[]},{"id":"7b9a0315.71ca9c","type":"modbus-client","z":"","name":"STP6.0","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.168.50","tcpPort":"502","tcpType":"TPC-RTU-BUFFERED","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":3,"commandDelay":200,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true},{"id":"8a11e8c7.342528","type":"ui_group","z":"","name":"Energy Meter","tab":"78892c6f.892384","order":2,"disp":true,"width":"6","collapse":false},{"id":"5be273cb.ceaddc","type":"ui_group","z":"","name":"Sunny Tripower","tab":"78892c6f.892384","order":2,"disp":true,"width":"6","collapse":false},{"id":"78892c6f.892384","type":"ui_tab","z":"","name":"Photovoltaik","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

```

### NOTES...

- Read the manual - especially `3.5.7 SMA Data Types` and `3.5.8 SMA Data Formats`
- the idea behind grouping modbus reads & using the buffer parser and using an offset reduces comms, improves performance and simplifies data - HOWEVER you need to be aware of the data sizes, data tyes & byte offsets to get the correct value.  
e.g. if you need 30447 (SINT) & 30449 (UINT32) then read 4 items, offset `0` will have the value of 30447 and offset `4` will have the value of 30449

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [26 September 2020 14:10 UTC](https://discourse.nodered.org/t/adding-two-values/32784/49 "2020-09-26T14:10:22Z")

</div>

you did it 😘

but I don´t understand the logic how it works 😖

I need

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

your flow got the right value with:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/ef64221259b33ff5237b053168364e7827beec1e.png)  
reading 31447 +52 to 31499

the buffer parser reads offset 100 🧐 🤨

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

don´t understand - but it is the right value 🤔

---

<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:** [26 September 2020 14:23 UTC](https://discourse.nodered.org/t/adding-two-values/32784/50 "2020-09-26T14:23:26Z")

</div>

> [@Becker](#):
>
> the buffer parser reads offset 100

offset it a byte value

> [@Becker](#):
>
> don´t understand - but it is the right value

FIRSTLY and most importantly, MODBUS registers are 16 bit values (2x 8bits) - bear that in mind for then following info...

* * *

In this particular part, we read 52 WORDS (16 bit values) (AKA 104 bytes) starting at address item `31447`

therefore...

if START ADRRESS = 31447 and we get a 16 bit value then

- byte 0 is lower 8 bits (lo byte) of 31447
- byte 1 is the high byte (another 8 bits) of 31447

so the next value in 31448 MUST BE...

- byte 2 is lower 8 bits (lo byte) of 31448
- byte 3 is the high byte (another 8 bits) or 31448

NOW - you need 32 bit values (i.e. addresses 31447 and 31448 make up the UINT32)  
In other words, you need bytes `0` ~ `3` to have the correct 32 bit value.

If you make the MODBUS read an ARRAY of 52 WORDS (AKA 104 bytes) then the very last byte is in position 103

Now, you need 4 bytes to make a 32 bit value so byte 100, 101, 102 and 103 are needed - hence the offset into the byte data is 100.

* * *

##### START ADRRESS = 31447

| address | Index | byte offset | Reason |
| --- | --- | --- | --- |
| 31447 | 0 | 0 | Start address + (index \* 2 bytes) |
| 31448 | 1 | 2 | Start address + (index \* 2 bytes) |
| 31449 | 2 | 4 | Start address + (index \* 2 bytes) |
| - | - | - | - |
| 31497 | 50 | 100 | Start address + (index \* 2 bytes) |

Does this look familiar...

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

... ^ look at the **buf parser byte offset** i wrote for `var` ^

I wrote that out to help you but I guess you didnt take the time to absorb it ☹

* * *

PS, read the built in help...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64e5d41c2a7c6a7e6d4f7362196f95dbccc9abf9.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:** [26 September 2020 14:51 UTC](https://discourse.nodered.org/t/adding-two-values/32784/51 "2020-09-26T14:51:27Z")

</div>

Hats off .. we can surely say that the above is the correct solution.  
you can freely move the solution to Steve's 😉

even if i had my small contribution with the Join nodes haha

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [26 September 2020 14:58 UTC](https://discourse.nodered.org/t/adding-two-values/32784/52 "2020-09-26T14:58:44Z")

</div>

I read his explanation 5 times, but I don´t understand it 100% and the problem I got. I'm too stupid for that sorry.

The Modbus Server (Inverter) don´t like multiple simultaneous requests, than he crashs.

how can I integrade Steves solution in the "Modbus Flex Getter" i build (every 5s one request of all) ?

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

I tried the value "var" to get in the buffer parser, but I dont work (yes I dont understand the logic behind, sorry).

---

<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:** [26 September 2020 15:05 UTC](https://discourse.nodered.org/t/adding-two-values/32784/53 "2020-09-26T15:05:00Z")

</div>

> [@Becker](#):
>
> The Modbus Server (Inverter) don´t like multiple simultaneous requests, than he crashs

2 alternatives...

1...  
Do the reads in series...

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

2...  
Where your join node connects to the multiple functions, you could replace them functions with buffer parser nodes with one entry in (zero offset) converting the ARRAY value to correct tpye

---

<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:** [26 September 2020 15:09 UTC](https://discourse.nodered.org/t/adding-two-values/32784/54 "2020-09-26T15:09:06Z")

</div>

> [@Becker](#):
>
> don´t like multiple simultaneous requests, than he crashs

In the Modbus Flex Getter device configuration you can you try to increase the Queue delay ?  
For example if you send the flex getter 4 messages .. the node has a built in queue that you can set its delay.

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

Also you may use the Modbus Queue Info node to monitor the queued messages. You dont need to wire this node to anyware .. but simply configure it to monitor your device.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/77536c88b8228f69c09aa71e20d033b67b149f0d.png)  
and see how many messages are being handled there ?!

---

<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:** [26 September 2020 15:10 UTC](https://discourse.nodered.org/t/adding-two-values/32784/55 "2020-09-26T15:10:31Z")

</div>

@UnborN great minds think alike ...

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

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

I will publish an update to buffer-parser soon 🙂

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [26 September 2020 17:53 UTC](https://discourse.nodered.org/t/adding-two-values/32784/56 "2020-09-26T17:53:42Z")

</div>

I thought I understand it, but I don´t 😪

==\> 31435 (S32)

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0e5f5ab1e6609663f72cd39f118628d4503400ac.png)  
quantity to 4 =\> 32bit (2x 16bit)

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/13e8f8dc6e1b3696abd8e9ebeb775df372fae7ee.png)  
don´t work 😒

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e132c0aca03fdf4332ad339d768a372e2b1fae61.png)

🤢

---

<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:** [26 September 2020 17:56 UTC](https://discourse.nodered.org/t/adding-two-values/32784/57 "2020-09-26T17:56:23Z")

</div>

Show me the code in the function that feeds into the buffer parser.

---

<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:** [26 September 2020 17:56 UTC](https://discourse.nodered.org/t/adding-two-values/32784/58 "2020-09-26T17:56:27Z")

</div>

read post 34 again

> [@Adding two values](https://discourse.nodered.org/t/adding-two-values/32784/34):
>
> and there is your problem the data required to be fed into the buffer parser is the data from the modbus node - not your hacked function (your function discards important parts of the data that make up a singed 32 bit value) Just like i posted in my demo last week and just like Andy said

i hate to be the bearer of bad news .. but you have to start with a clean flow .. and copy paste any parts you may need from the old DISABLED flow 😉

besides all important logic is from Steve's flow

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [26 September 2020 18:04 UTC](https://discourse.nodered.org/t/adding-two-values/32784/59 "2020-09-26T18:04:41Z")

</div>

New Test Flow ---\> till I understand it just easy going!

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/646d177c7a042f34408e8e3844f7b9e556451331.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e50f0d45cd82cde56cac60a3ffa10d92da8b358.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/6/562aa2dbd67592bf900512a66faaf2a08633f7b4.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/352715368c7f6c61d9386ef729dac48e99497078.png)

=\>bullshit value

edit, i think I got my mistake: offset has to be 0 🤭

tomorrow I can test the reactive power... now it´s dark outside 😉 -\> no sun power

---

<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:** [26 September 2020 18:12 UTC](https://discourse.nodered.org/t/adding-two-values/32784/60 "2020-09-26T18:12:11Z")

</div>

And what does the above value supposed to represent ?  
what is the expected value ?

this ?  
Metering.GridMs.A.phsA 31435 2 S32 FIX3 RO A Grid current phase L1

> [@Becker](#):
>
> offset has to be 0

yes .. since you are only reading that specific value

and after, with a function, you have to divide it by 1000 to get the correct result because it says its FIX3  
unless you updated to the latest version of **buffer parser** 😉 that has a scale option

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [26 September 2020 18:19 UTC](https://discourse.nodered.org/t/adding-two-values/32784/61 "2020-09-26T18:19:48Z")

</div>

> [@Steve-Mcl](#):
>
> Show me the code in the function that feeds into the buffer parser.

In my old flow it doesn´t work - damn.

just the same as in the test flow:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/7727ad2f628ef5b5d019e6f43c21d562c2cd95ca.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c568453a960a02c9e2a7e6e561016fb433ef6716.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/85471d2016837f55c1a7c8ea29ace506bf116f67.png)  
but this time trash output

[Previous page](https://discourse.nodered.org/t/adding-two-values/32784.md?page=2)

[Next page](https://discourse.nodered.org/t/adding-two-values/32784.md?page=4)
