Modbus binding with Sunny Boy SMA inverter

Hi Steen.
My SMA inverters have bluetooth as well as ethernet interface. The modbus protocol is activated through the ethernet (TCP/IP) protocol. But it needs to get activated inside the configuration of the inverter. Its default set to OFF.

Thank you @Kim_Andersen
Great job, this will really help.
I see you’re reference a function in smalimit1000.js . What is that script doing?

I wonder if you’ve worked on any graphical representation or only on data value ?

And for sunspec modbus there is also separate binding to make it even easier for users (no need think register numbers etc.) : https://www.openhab.org/addons/bindings/modbus.sunspec/#sunspec

Not sure if you can get more data out with generic modbus binding but I thought it was worth mentioning

I would also agree with this.
Just one more information which might be important if you want to read out data with the SunSpec-Profile:

The SunSpec Modbus profile for SMA devices starts at the Modbus register number 40001 and can be addressed via the Unit ID = 126 (see Section 3.4 “Addressing and Data Transmission in the Modbus Protocol”, page 11).

I will do a commissioning of a SMA Tripower soon and also want to try SunSpec. So I will keep you updated.

Ahh crap… Forgot to add… :frowning:

The smalimit.js just divide by 1000, like the other, divide1000.js. Difference is, the smalilimts1000.jz take care if the readings are less than zero, its equal to UNDEF…
Like this:
smalimits1000.js

(function(i) {
    if(i < 0) return "UNDEF";
    return parseFloat(i) / 1000
})(input)

Thats because some of the registers return a negative number, when the register isn´t active, (like when the sun has gone down, there will be no producing of power, ofcouse. The registers of the power producing will return to negative. It´s all in the official SMA modbus documents).

And this is the divide1000.js

// Wrap everything in a function
(function(i) {
    return parseFloat(i) / 1000;
})(input)
// input variable contains data passed by openhab

I havn´t made any any graphical presentation, except for whats in the sitemap. I mainly use it to monitor. My plan was to make somekind of grafical interface in my svg I use in habpanel. But I havn´t got as far yet.

I have not tried the sunspec modbus. Mainly because I prefere to do it manually, as it makes me feel I´m in more controle of things :slight_smile: But it would be fun to see, which registers sunspec actually gets in auto discovery.

Unfortunaly my modbus/openhab has screwed up for a coupple of weeks now.
For some reason I can no longer install modbus binding without getting an error. I´m very sure this has be caused by openhab sreewing things up, somewhere. Most of my systems works as it used to, but modbus and Ring binding simply refuses to install. I havnt had time to investigate this futher. So atm my modbus is offline. I have no idea how this happened. Log shows it just restarted (rebooted my Odroid running ubuntu). After that, It just happened out of the blue at the 16. october, but only for the modbus binding and Ring binding :frowning:

I have a plan to reinstall everything (fresh setup), cause I couldnt fix the openhab setup with an update to 2.5.10 either (infact upgrading openhab also resulted in an error). But due to lack of time I havn´t yet.

@Kim_Andersen, thank you for your help.:+1:
I’ve successfully implemented your scripts in a few minutes with my SMA 10000TL-20 , without any knowledge of the MODBUS.
May be a last detail … where can I find the ‘SMA.map’ config file or at least, the values to recreate it?
Regards

Hi Kim
Thank you, it looks like my Sonny Boys are able to send Modbus, not even if I get an ethernet connection module, unless anyone know better

Great you got up and running.

Damit! yet another file I forgot to add :roll_eyes:
Here you go… SMA.map:

/ Device Type
9098=STP 5000TL-20
9099=STP 6000TL-20
9100=STP 7000TL-20
9102=STP 9000TL-20
9103=STP 8000TL-20
9281=STP 10000TL-20
9282=STP 11000TL-20
9283=STP 12000TL-20
9326=Sunny Boy Storage 2.5

// Condition
35=Fault
303=OFf
307=Ok
308=On
455=Warning

// Recommended action:
336=Contact manufacturer
337=Contact installer
338=invalid
887=none

// Grid relay/contactor:
51=Closed
311=Open
16777213=Information not available

// Operating status:
295=MPP
381=Stop
443=Constant voltage
1392=Fault
1393=Waiting for PV voltage
1467=Start
1469=Shut down
1480=Waiting for utilities company
2119=Derating
ON=On

// Battery oper. status:
2291=Battery standby
2292=Charge battery
2293=Discharge battery

Status battery application area:
2614=Own consumption area
2615=State of charge conservation area
2616=Backup power area
2617=Deep discharge protection area
2618=Deep discharge area

Please notice, not all codes has been mapped, only those I cared for adding :slight_smile:
For the first section, there really isnt no need to add devices which you havnt got. I just added all of them directly from the Excel document by the use of copy/paste… Ie… it takes longer to leave out those I dont need.
I know, stupid explanation. But I love to use copy/paste, and sometimes things just doesnt make sense, but doesnt ruin anything. So I leave it at that. :rofl:

In case you´re missing something, please consult the official SMA modbus list of registers. (Its an Excel document with all registers for most of their devices).
If you havn´t already got it, I can add it later.

1 Like

Hmm… How would you connect the modbus interface, if it hasnt got ethernet? Does the manual tell?
(It could be a serial connection. It could also be Wifi. But I really doubt it will work from bluetooth).

it’s perfect for me … my installation is listed :wink:

1 Like

There is an option for a RS485 expansion module, but my Sonny Boy 2500HF and 3000HF is not listed for Sonny Boy that support modbus that I found here

If your manual doesnt say, you probably have to ask SMA. They´re usually quite nice to answer fast for questions like that. The list you refere to does not help you.

2.5.9 Modbus binding distribution has messed up packaging, will not install.
Under some circumstances - don’t know what - the installer helpfully tries to upgrade 2.5.x to that version, and fails.
With 2.5.10 now released this should all be sorted, but you may have to clear it up manually.

Yeah, but I use the special version ssalone made to fix the modbus issue in previous version. Thats the one I can no longer install, even though I´m at 2.5.9 and it has been running since he released it and untill the 16. of october.
I tried to upgrade openhab to 2.5.10, but that failed as well.
So right now I´m kinda stucked without modbus, and probably need to start from a fresh 2.5.10… Just need the spare time :frowning:

Well now it’s probably being "helpful’ and trying to autoupgrade to 2.5.10 … but someone has put a manual jar in the addons folder, which will cause it to fail.

I´m not sure I understand what you mean?
Will the modbus 2.5.10 binding jar fail on openhab 2.5.9 ?

I don’t know. It certainly won’t work if you have a jar in addons. You can look in your openhab.log and find out if it is the installer is messing up on modbus, instead of us all guessing.

I´m not asking anyone to be guessing. It is the installer which mess up.

Oookay, you are the only one that knows what it says.
But you now know it’s not going to work with the jar in addons, and you’re the only one that can sort that out too.