Modbus query SMA Inverter - the right way

Good spot.

That might be necessary. It may be that the inverter deliberately sends this value when there its value is invalid / empty. Doe the value look normal when operating during the day?

Life beckons, might get 5 minutes later this evening.

Yes, all values are normal when the inverter(s) are online, as you see in my screenshot (https://global.discourse-cdn.com/business6/uploads/nodered/original/3X/2/e/2e733f5307cd1bee5a79db5a3736ee78adf9a9af.png)

Can someone tell me a function expression with "if ... msg.payload receive = -2147483648 than make value = 0" :crazy_face:

if (msg.payload == -2147483648 ) {
    msg.payload = 0;
}
return msg;

by the way your devices are Sunny boy and tripower .. each have their own seperate addresses or is the modbus address table common ?

1 Like

thank you,

each have their own IP adress

ok .. IP i understand that its different ..
im talking about the manual / document that you see the list of modbus adresses.
(you shared one with Google Drive at some point)

Each device has seperate list of addresses or is it for both devices the same ?
for example address 30769 refers to the same value for Sunny Boy as it does for Tripower ?

many registers are same, the SB3000TL-21 does not have its own document. I just found the big brothers " STP 15000TL-30 / STP 17000TL-30 / STP 20000TL-30 / STP 25000TL-30".

and tried it out.

the STP6 reads out the energy meter, so I can query the energy meter (has no modbus, just speedwire) by quering the STP6 modbus.

this is my final flow:


if anyone is interested :nerd_face:
1 Like

nice project .. with your thread and Steves lecture posts i finally learned modbus data types
more than any youtube video :wink:

by the way .. there is some interesting information in FAQ of SMA website that may be related to those high negative values at night.

1 Like

:flushed:

:joy::joy::joy::joy::joy::joy::joy::joy:

nice found.

but NaN is not -2147483648 or is it?

NaN cannot be sent over modbus (only numbers)

foreword...

Remember that -2147483648 is the same as 0x80000000

my thoughts on this matter...

It might be undocumented for that inverter that NaN will be sent over modbus as a number with only MSB set (0x80000000)

And since the manual states NaN is essentially zero, you might as well use @UnborN suggestion of if (msg.payload == -2147483648 ) msg.payload = 0

Alternatively, you could set the MASK in the buffer parser to simply remove the MSB
e.g. a MASK of 0x7FFFFFF will "turn off" the highest bit
i.e. 0x80000000 will become 0x00000000 which is essentially 0

1 Like

by the way: what means the 0x before the value in hex ?

its how you specify a value is hexadecimal in JS (and many other languages).

var a = 0x8000;
console.log(a); // --> outputs 32768

Also, its so you (the reader) can see that it is hexadecimal :slight_smile:

Similar to octal...

let o = 0o51;
console.log(o); // --> outputs 41
1 Like

@Steve-Mcl I mentioned you with praise on my blog: Link
if you feel like it, you can take a look over it (with translating tool) and tell me if there are mistakes.

1 Like

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