SMA SunSpec over Modbus

Hi all, especially @mrbig :sweat_smile:

I’ve tried to get rid of a webscraper script to gather information from my solar power inverter and tried to use the modbus binding for this job.

Sadly, the binding seems to interpret the numbers wrong. F.e., I get 327,68 HZ for the grid frequency - which would be no good :rofl:

@mrbig , could you help me to help you implement this or can you show me where I can do the hard work?

Best regards,

BTW, the Spec is

That’s suspiciously 7FFF in hex i.e. a duff register.

Are you using Modbus binding with Sunspec extension? What model SMA are you talking to?

I have a STP 20000TL-30. First I wanted to read out the data with the modbus SunSpec profile. But it did not work. I also had strange measurement-values.

So I switched to the “normal” modbus data provided from the inverter.
A full list of all modbus parameter and measurements you can see here:

I am not sure if the DataType of the implementation of the binding is matching with the data type of the sma implementation. See here:

1 Like

Who knows. That would depend on what you have set into your Things, we can’t see those.

You may also need to bear in mind the “offset -1 register address/number” issue.

I was curious and tried it again. So I created a “New Three Phase Inverter”-Thing.
Configuration looks like this:

Measurements look like this:

The values seem to be like just the maximum of some datatypes:
Power, Voltage, Current = BYTE = 255
Frequency = INT = 32768

I also tried with different “Start Addresses” like 39999 and 40001, but then inverter thing does not come up (=ONLINE).

When I read out the SunSpec registers manually the value is either 0 or 65535. So for me it looks like there is something wrong with the SunSpec profile on side of SMA. It also could be a configuration problem…?

But as I said I am ok with this, the solution for me is to set up the poller and things manually and read out the “normal” sma modbus registers.
I just wanted to give feedback.

Ah, from your post I misunderstood that you had trouble with generic Modbus things as well…

Hi @Sascha_ ,

as rossko57 stated that value is a not-a-number value, that means the inverter does not have a correct value for the field, or it is not implemented. The reason why the binding still displays the raw value is that according the spec the line frequency is a mandatory value, so we’re not prepared to receive such a value.

Are the majority of the other fields incorrect as well?

I have found this detailed specification from SMA: And this seems to match with the sunspec specification that the binding is using.

@Tuny the binding check s the data that has bean read for the well known fields to avoid displaying incorrect data. So if it does not come inline means that the address is very likely to be incorrect.

Did you use auto detection to detect the inverter? If so what address does it show under the properties? If you configured it manually, then please try to set the address to 40186 (also try experimenting with 40185 or 40187) because SMA uses a different start address.

1 Like

Hi guys,
thank you all for your input. Sadly, I had no time to follow this issue in the meantime.

Yes, all fields show incorrect values. Thank you for checking with the SMA Spec :muscle:

What (sort of) works for me is polling registers 30513 and 30775 for total yield and instantionous power . Sort of because of the invalid high numbers (NaN) in the night when the inverter itself powers off.

To my surprise, I couldn’t find my registers in the spec you linked.
30513 seems to be 40210 (total yield) and 30775 seems to be 40200 (active power).
I found this doc from SMA where the registers match my usecase.

I’m starting to think that there needs to be a “SMA SunSpec” profile in the binding. What you you think about this?


Auto detection did not work on my system.
…but now it seems to work with SunSpec. The measurements that are shown look valid.

How it is done:

These are normal modbus registers from sma. No SunSpec.

Thanks @Tuny,

according to this SMA also has a correct SunSpec data format, but at a different address than SolarEdge uses. However the autodetection should had detected the correct address, so if it didn’t that is a bug in the binding.

If you could turn on logging for the modbus communication and log the autodetection process (with the modbus register dumps) that could help identify the problem.

So long manual setting could be a solution. Also according to @Sascha_ the inverter might reports invalid data while not producing power, but that could be normal.

Thank you both, @Tuny and @mrbig !

Yes, thats desired behavior according to the spec sheet. One shall query the state of the inverter before interpreting values as the inverter might be offline leading to NaN values. Perhaps the binding could do this step as otherwise every value needs a proxy item and rule.

I did this with much success. Thank you very much! Not all channels show sensible values (e.g. state is “Off” while producing) but others are valid (yield, total yield, cabinet temp, frequency). Others display Err (e.g. Phase A,B,C voltage).
Just a notice: Precision with the previous registers had been down to 1 W, now its 10 W.

Thank you :slight_smile:

Yes I can. But just to understand you right:
I create a “Modbus TCP Slave” with “Discovery Enabled” then I search for new devices and the “Three Phase Inverter” should show up automatically?

@Tuny , yes that should be the desired behavior. Also it should autodetect the address 40185. If not, then there is some trouble in the autodetection routine