Modbus binding with Sunny Boy SMA inverter

Hi Gustav,

Sorry for my late answer, I don’t look often on this forum lately.
I’m not sure what you exactly asking. I use an internal IP-address within my home network.
Perhaps you mean the registers ?

I have OpenHAB recently updated to 2.5.10 without issues. Modbus is communicating properly since the issues mentioned in version 2.5.7

Kind regards,

Hi Pieter

Solved the issue by using an ethernet cable directly connected to my sma sunny boy. I used WLAB when I posted this message as I ä could not establish a connection to my SMA sunny boy.


Den lör 28 nov. 2020 20:06Pieter via openHAB Community <> skrev:

has anyone tried to set the output power ? Is it data block 40268 (Setting for maximum output active power (WMax) ? What would be the syntax for this ?

Thank you so much for these informations! It works perfect on my side, just with copy and paste :slight_smile: I just needed to install the map transformation within the openhab 3 ui.

I have just one Question. I am searching for another value… The Total consumption value of my house. I could not find an option in Modus, neither in the webguis of the inverters and of the energy meter. But in the webgui of SMA or in the iOS App, there is the consumption displayed. Someone knows, where to get that value? Or do we have to calculate it in a way, with our known values? Perhaps someone has a good idea on that.

Dear Alaub81,
fighting myself to get my Sunnyboys connected I might be able to help you.
As you mentioned that your devices know about your total house consumtion I believe you have a sunny home manager installed? If so, try to find the preconfigured binding (the only one in the list if you look for “SMA”)

Once this binding is installed, the SHM will show up in your inbox, ready to install itself with a mouseclick…

Dear All,
thank you very much for this valuable conversation.
I tried so many things, but didn’t succeed to get connected although I already mastered to connect and read the right registers with help of a labview code.
Let me sum up my knowledge so far, since it might give a new starting point withing this thread that is filled with so many useful information already:

  • The registers are layed open in the latest SMA-modbus-documentation: (https://Device-specific Modbus adresses - Photovoltaikforum)
  • this time both is included - 30000-values (SMA-proprietary) AND 40000 (Sunspec).
  • a bit unclear is whether to use UNIT ID 2, 3 or 126. Different sources give different answers here. (using my labview code I must insert 126 to receive correct values from my SB2.5-1VL-40 )
  • Starting with this insights, I tried to see values through OH3, but never succeeded. IP is set correct and the inverter is answering on port 502, I could make sure.
    Copying differend, slightly adopted “.things” from above in this thread sometimes lead to new entries within the things group, sometimes not. If they appeared, the items are even somtimes green “online”. But I never got the right values.
  • might this be due to the modbus bindings I installed in the beginning but didn’t work (e.g. the generic “SinglePhaseInverter”? - I believed this should do since it follows the sunspec register-definitions)
  • I did also not find a useful manual how to get rid of a binding, once it was installed!?

Any help highly appreciated!!

Stepping in house outomation with a lot of photovoltaic knowledge my future ideas (once I get the base work done): binding in the EV-Charging station as well, offering opportunities as e.g.

  • priorisation of one or the other station (in case of two)
  • giving the User the choice to choose whether first charge the car(s) or better the battery to come over the night
  • all this and maybe more included in this great hause-dashboard called openHAB
    See U!

No, I do not have the home manager, I only have the energy meter. And there I already have installed the binding. It works, but there is no total consumption value.

sorry for the late reply on this.
Unfortunatly you cant. You need to calculate it yourself. If you have the SMA energy meter, then you can get the current usage on each phases. Thats probably the best option.

Energy Meter will tell you the current (consumption) of each phases, Then you just have to calculate it to kWh´s (energy) :smiley:

Check your openhab log to make sure you get answers from the registers (channels) you´ve been adding.

In generel: Start simple. Modbus is not complicated, but it´s very easy to loose overview when dealing with many channels (things).
Make sure you have the correct registers. And know what data to expect to receive.

This is probably the best advices I can give.

1 Like

thanks for the answer I calculated it in that way:

  val Number TotalPower = (inverter1ActivePower.state as DecimalType
    + inverter2PreBatDischarge.state as DecimalType
    + inverter1PowerDrawn.state as DecimalType
    - inverter2PreBatCharge.state as DecimalType
    - inverter1PowerGridFeedIn.state as DecimalType)
  if ( TotalPower >= 0 ) {

But I will try your solution, too :slight_smile:

Just for documentation here …
I have installed the two inverters SMA Tripower 8 and SMA SunnyBoy Storage 3.7-10.

I uploaded all my configuration files to GitHub:

Also did a German documentation on my wiki:

thanks for sharing.
As a little feedback, get familiar with usingUnits of Measurement. Do not use [%s] everywhere in .items (but %d, %.0f etc). If you properly define the items with UoM you won’t need that [ ] part.

you are totally right :slight_smile:

could you please give me a hint how I could get it work without a state description [%.0f W]?
I changed the item type to Number:Power, but without [%.0f W] I don’t get the state description. I think the channel must support that, too?
Perhaps you have a tip for me, how to get that also working, so I could change my documentation.

You should be by default. But it depends where you are talking about it’s a complex question.
You can edit item metadata in UI (pattern field, same format ie [%.0f W])

fixed the Units of measurement stuff and also added somatic model tags to the items file. Update is pushed to GitHub and also documentation is updated.

Thanks again @mstormi for your feedback.

Thank you for the documentation.
I got this to work with my SMA SunnyBoy 2.5 on OH3
Looks like everything is working, except that the numbers don’t get divided.
Like for the “grid voltage phase L1” is displays 23123.00V instead of 231.23V
It looks like the smalimit100.js file is not used.
Could you help me with this?

Where did you put it?
Have you installed the JS transformation add-on?

That’s it, forgot those add-ons.
Now it works fine.
Thank you for the fast response.

Excellent work @alaub81 !