Modbus query SMA Inverter - the right way

Hi, this is the continuation of Adding two values

thank you @Steve-Mcl and @UnborN for your help so far !

First a make a overview of my registers:

I need help:
How can I "Do the reads in series" like this:

and how can I "scale" ?

Have you tried whats in that screen shot?

install latest version

image

in 2.4.0 is no scale. ok I have to restart the RPi...

nope didn´t try, because I don´t know what you did behind in the buffer parser :thinking:

I'm still wondering what the best order is, there are a total of 962 register if I make one query.

The max size of requesting registers is 100 (seems to be a design flaw in the underlying modbus library)

thats why i grouped the registers you were wanting into 4 groups.

I didnt change anything from the last flow posted - except the wiring (instead of the INJECT connecting to each MODBUS node, i wired them in series instead).

1 Like

yes, I think SMA said max. 125.
this is my plan:


I think it will work, will be some work - but then its correct :smile:

1 Like

Works great, thank you @Steve-Mcl for your solution

That is a LOT better than what you had in first version.

Perhaps you learn some stuff too (like data types and sizes etc).

Good luck.

1 Like

Yes I learned a lot ! Unfortunately, it always takes a while for me to make "click" in my head. :nerd_face:

After learning so much I got a little problem:

what is the trick to get the values to the right text

a function node (filter) before every text ?

no, just use the path as copied from debug...

1 Like

damn, to late :frowning:

here my build: https://drive.google.com/file/d/1Qj0QXhKL5U78LUImnLXfdFHw94ooMxhA/view?usp=sharing

but for my join nodes I need the function before

was your answere wrong @UnborN ?

now the Inverters are off:


they put out a big shit :unamused:
and this makes my calculation of "Leistung PV gesamt" & "Leistung Verbrauch" error

any idea @Steve-Mcl where these high values come from

Not without seeing debug values (coming out of modbus AND buffer parser)

is this ok ?


i think it is the most smallest/negative value.

Maybe I have to correct my formel for the calculation of:


with an if / else ?
if PAC1 < 0 than send "0" or something like that ?

It is almost impossible to tell from the screen shots.

but - I suspect you have misalinged the data - perhaps the 2nd modbus labelled 30769 is reading from an even number like 30768 or 30770 or something else (because I expected to see 0 values in [0] and [2] etc - based on what I seen in previous data)

If you want some help, do this...

  1. capture the debug output (use copy button) of the 30769 modbus node
    paste the copied data between backticks like before

  2. select the 30769 modbus node and the buffer parser node (draw a box around to select them
    select these nodes) then EXPORT (CTRL+E) those 2 selected nodes
    paste (the copied 2 nodes flow) between backticks

{"topic":"f52b72ff.9cc7","messageId":"5f71015947eeb9e589a139d2","payload":[32768,0,32768,0,32768,0,32768,0],"queueLengthByUnitId":{"unitId":3,"queueLength":0},"queueUnitId":3,"unitId":3,"modbusRequest":{"value":{"W2":10.496},"unitid":"3","fc":4,"address":"30769","quantity":"8","messageId":"5f71015947eeb9e589a139d2"},"responseBuffer":{"data":[32768,0,32768,0,32768,0,32768,0],"buffer":[128,0,0,0,128,0,0,0,128,0,0,0,128,0,0,0]},"_msgid":"de660e7d.705db"}
[
    {
        "id": "cca0add4.907ac8",
        "type": "modbus-getter",
        "z": "d2d6601a.7125f8",
        "name": "30769 - 30775",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "unitid": "3",
        "dataType": "InputRegister",
        "adr": "30769",
        "quantity": "8",
        "server": "101bd986.8eac7e",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 340,
        "y": 180,
        "wires": [
            [
                "a18b0ca9.912008"
            ],
            []
        ]
    },
    {
        "id": "a18b0ca9.912008",
        "type": "buffer-parser",
        "z": "d2d6601a.7125f8",
        "name": "",
        "data": "responseBuffer.buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int32be",
                "name": "IDC2",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": 0.001,
                "mask": ""
            },
            {
                "type": "int32be",
                "name": "UDC2",
                "offset": 4,
                "length": 1,
                "offsetbit": 0,
                "scale": 0.01,
                "mask": ""
            },
            {
                "type": "int32be",
                "name": "PDC2",
                "offset": 8,
                "length": 1,
                "offsetbit": 0,
                "scale": 1,
                "mask": ""
            },
            {
                "type": "int32be",
                "name": "PAC2",
                "offset": 12,
                "length": 1,
                "offsetbit": 0,
                "scale": 1,
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "output",
        "multipleResult": false,
        "setTopic": true,
        "x": 570,
        "y": 180,
        "wires": [
            [
                "e385cd42.5fa938",
                "c9437f20.6d3a18",
                "e6f243e.8c5ee4",
                "955c6aca.99d25",
                "26d6e751.a449d"
            ]
        ]
    },
    {
        "id": "101bd986.8eac7e",
        "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
    }
]

good morning, now the Inverter (STP6) has woken up:
grafik


(the other is still sleeping)
all values seems to be right

basically i was just going to suggest, adding a Join node after the buffer parsers in order to wait and merge the 11 separate parser replies into one merged Object .. so you'll have all your values simultaneously available for calculations. This way you can avoid the separate joins and makes the flow a little cleaner. maybe :wink:

image

ps. I didnt have your new flow imported at the time and my post was rushed so i deleted.
and also you had other more important things to sort out (with addresses and offsets) and i didn't want to side track the thread.

1 Like

I'm still waiting for the answer from @Steve-Mcl,

but any idea how to set the function node (which is adding the 2 values) that he should ignore values under 0W or explizit the value "-2147483648W" (at night) ?

for example:

var temp = (msg.payload.PAC2)
msg.payload = temp;
msg.topic = "PAC2"
return msg;

here a formula / expression "if msg.payload < 0 than give 0 to output" ?

well 2147483648 is 0x80000000 in hex so looks suspiciously like a signed int overflow.