Adding two values

@Steve-Mcl you are totaly right :woozy_face:

I got 2 problems
yellow: if the DC-Voltage get over "65535" -> 655,35V the Voltage begins at 5-10V.

red: if reactive power get negative, the value get on very high like 65500.

I need an Explanation what i have to do with the buffer parser

I gave you detailed info and a flow here.

I also said you might need to chose the (be) versions or do a swap16 on the data.

All you replied was "

I can assure you it does - the screen shot shows it works (albeit with zero values)

Give it a go and if / when you get stuck, I can help you figure it out.

i want to understand the problem, and only "buffer parser" the necessary values.

I understand the values are S32 -> 32bit signed -> 16bit positive and 16bit negative.

Hi Becker,

Did you manage to get buffer parser working ?

I was testing today aIso with an Energy Meter, my brother had, that uses 32bit values.
in my case it was 32bit float and buffer parser read it with no problem.
like a hot knife through butter :smile:

Try every combination :wink:
int32be, int32le, swap, no swap till you get the result
just make sure you are sending the modbus msg.responseBuffer.buffer to it.

By the way is this the link to your devices modbus documentation ?
I went in Downloads then Background Knowledge and downloaded the first zip

thank you,
i used the windows app:
integer decimal

"decimal" is the wrong value, which I get in Node RED.
"integer" ist the right, but no matter what I try in the buffer parser it doesn't work, always wrong values...

the nearest result is:

~ -230 is original value

  • try swap16 in the "Byte Swap"
  • try int32 (be) in the items list
  • try different combinations of both

The issue is that manufactures use various formatting (big endian, little endian, etc) & if you dont know what that is, you have to use maths to figure it out (or play with the settings as suggested above and by Andy )

and also try to find the correct documentation with the addresses .. dont "guess" the address by using that Master simulator :wink:

I´ve tried them all :sleepy:

the documentation:

reactive power is number "31497"

Not quite.

Often implementations of modbus mess up what is the first value. Sometimes it's 0, sometimes it's 1. Sometimes it's 4000 sometimes it's 40000 etc

For example, offset 1 might be where your data is (not offset 0)

Do me a favour.

  • Set fixed values in your simulator & post a screenshot showing what values you entered.
  • Operate your flow and capture the debug output of the modbus node by clicking the copy button on the debug output. Make sure debug node is set to show complete message.

Using debug to copy value...
Vmz3Zy8Buu

Post results below.

```
like this
```

I will show you how to do it.

I´ve no simulator :roll_eyes:


Offset 1 is right, I choosed it before it goes in the buffer parser!

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

Here is my complete post again - try it & see where you get to...


Hi again, as mensioned earlier, this is how you can do it with buffer parser...


(obviously I dont have your invertor so all values are simulated - zero)

this is the flow i did...

[{"id":"3c70a20c.01d53e","type":"inject","z":"15164b61.40f905","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":300,"wires":[["bb340a9c.a81c58","7bdb6cd4.f23b24","58e3fd6c.ca7b04","4d07d7f8.99b288"]]},{"id":"bb340a9c.a81c58","type":"modbus-getter","z":"15164b61.40f905","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":480,"y":220,"wires":[["768c153b.df699c"],[]]},{"id":"7bdb6cd4.f23b24","type":"modbus-getter","z":"15164b61.40f905","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":480,"y":280,"wires":[["5e0a1ec.aeb7ce"],[]]},{"id":"58e3fd6c.ca7b04","type":"modbus-getter","z":"15164b61.40f905","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":480,"y":340,"wires":[["7cdd5a8a.43b644"],[]]},{"id":"4d07d7f8.99b288","type":"modbus-getter","z":"15164b61.40f905","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":480,"y":400,"wires":[["b7162329.e0cc4"],[]]},{"id":"768c153b.df699c","type":"buffer-parser","z":"15164b61.40f905","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32le","name":"PDC2","offset":0,"length":1,"offsetbit":0,"mask":""},{"type":"int32le","name":"PAC2","offset":4,"length":1,"offsetbit":0,"mask":""},{"type":"int32le","name":"Pbez","offset":184,"length":1,"offsetbit":0,"mask":""},{"type":"int32le","name":"Pein","offset":188,"length":1,"offsetbit":0,"mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":670,"y":220,"wires":[["bc60faef.9b6c08","15f17a3a.bf22a6","c2e5e0ec.242a1","865fdaa3.0ff7b8","52e8c22d.52cb6c"]]},{"id":"5e0a1ec.aeb7ce","type":"buffer-parser","z":"15164b61.40f905","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32le","name":"T2","offset":0,"length":1,"offsetbit":0,"mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":670,"y":280,"wires":[["ed2f8fed.778a1","121cd028.592a7"]]},{"id":"7cdd5a8a.43b644","type":"buffer-parser","z":"15164b61.40f905","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":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":670,"y":340,"wires":[["e77c39b2.ab0da8","96e6d1a4.95cf5","b7d0340e.8bd868","25aca7ac.e71e78"]]},{"id":"b7162329.e0cc4","type":"buffer-parser","z":"15164b61.40f905","name":"","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32le","name":"Hz","offset":0,"length":1,"offsetbit":0,"mask":""},{"type":"int32be","name":"var","offset":50,"length":1,"offsetbit":0,"mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":670,"y":400,"wires":[["d8a23fa6.0a779","d0023be2.999bb8","2405d4f1.155f9c"]]},{"id":"bc60faef.9b6c08","type":"debug","z":"15164b61.40f905","name":"parser1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":920,"y":60,"wires":[]},{"id":"15f17a3a.bf22a6","type":"ui_text","z":"15164b61.40f905","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":910,"y":100,"wires":[]},{"id":"c2e5e0ec.242a1","type":"ui_text","z":"15164b61.40f905","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":910,"y":140,"wires":[]},{"id":"865fdaa3.0ff7b8","type":"ui_text","z":"15164b61.40f905","group":"5be273cb.ceaddc","order":1,"width":0,"height":0,"name":"P-AC2","label":"Leistung AC","format":"{{msg.payload.PAC2}} W","layout":"row-spread","x":910,"y":180,"wires":[]},{"id":"52e8c22d.52cb6c","type":"ui_text","z":"15164b61.40f905","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":910,"y":220,"wires":[]},{"id":"ed2f8fed.778a1","type":"ui_text","z":"15164b61.40f905","group":"5be273cb.ceaddc","order":3,"width":0,"height":0,"name":"T2","label":"Temperatur","format":"{{msg.payload.T2}} °C","layout":"row-spread","x":910,"y":320,"wires":[]},{"id":"121cd028.592a7","type":"debug","z":"15164b61.40f905","name":"parser2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":920,"y":280,"wires":[]},{"id":"e77c39b2.ab0da8","type":"ui_text","z":"15164b61.40f905","group":"8a11e8c7.342528","order":3,"width":0,"height":0,"name":"U-L1","label":"Spannung L1","format":"{{msg.payload.UL1}} V","layout":"row-spread","x":910,"y":420,"wires":[]},{"id":"96e6d1a4.95cf5","type":"ui_text","z":"15164b61.40f905","group":"8a11e8c7.342528","order":4,"width":0,"height":0,"name":"U-L2","label":"Spannung L2","format":"{{msg.payload.UL2}} V","layout":"row-spread","x":910,"y":460,"wires":[]},{"id":"b7d0340e.8bd868","type":"ui_text","z":"15164b61.40f905","group":"8a11e8c7.342528","order":5,"width":0,"height":0,"name":"U-L3","label":"Spannung L3","format":"{{msg.payload.UL3}} V","layout":"row-spread","x":910,"y":500,"wires":[]},{"id":"25aca7ac.e71e78","type":"debug","z":"15164b61.40f905","name":"parser3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":920,"y":380,"wires":[]},{"id":"d8a23fa6.0a779","type":"ui_text","z":"15164b61.40f905","group":"8a11e8c7.342528","order":6,"width":0,"height":0,"name":"Hz","label":"Frequenz","format":"{{msg.payload}} Hz","layout":"row-spread","x":910,"y":600,"wires":[]},{"id":"d0023be2.999bb8","type":"ui_text","z":"15164b61.40f905","group":"5be273cb.ceaddc","order":3,"width":0,"height":0,"name":"var","label":"Blindleistung","format":"{{msg.payload}} var","layout":"row-spread","x":910,"y":640,"wires":[]},{"id":"2405d4f1.155f9c","type":"debug","z":"15164b61.40f905","name":"parser4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":920,"y":560,"wires":[]},{"id":"870d2fa5.fa314","type":"comment","z":"15164b61.40f905","name":"STP6.0-3AV-40","info":"","x":220,"y":260,"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}]

These are how i decided to group the reads up into 4 parts & the offsets I used in the buffer parser...

NOTE: I couldnt find an exact manual but this one suggests values are S32 (Signed 32 bit integers)

So if you find the values comming out of buffer parser values are not correct, then simply change the settings...

1 Like

tried all 4 combinations in your flow

good thing you send the screenshot .. I think its better to make a new start on a new tab/flow.
Copy paste your nodes from the existing tab to a new one, delete whatever is after the Modbus flex getters nodes and disable the old flow.

Also to fully understand what a buffer is put a complete message debug node directly after the Modbus flex getter.
image

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

  2. copy the values...
    Vmz3Zy8Buu

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

  4. tell me what the values SHOULD be

a side note .. by the way from the documentation

take in consideration that some values may be S32 others unsigned 32

well it´s the same like before:

var should be approximately -350 (-200 to -400)