Modbus binding with Sunny Boy SMA inverter

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!
    Ansgar

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 ) {
    TotalPowerConsumption.postUpdate(TotalPower)
  }

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:

2 Likes

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 !

I have the same issue, and migrated to openhab3. The modbus is working but the values are off.
Does some one have this working with the modbus binding?

Yes I’m even selling an Energy Management System to use it.
You can download the demo and extract the config.

Thank you for the response, can you point me to the correct folder? I did download the demo but was unable to find the openhab folder.

Thanks!

Click System, Photovoltaik to select your inverter and the things/items will be created and appear in Main UI.

Thanks for all the input and the good documentation of the things and items.
But I’ve got one more question.
What about the decimal places? You use a int32 type. For things like daily total production there would be nice to see 10,252 kWh instead of 10kwh.

Is it possible to change it?! Any ideas or solutions?

Thanks