Modbus connection with SMA inverters

i’m trying to get the power given by the SMA sunny tripower by using the sunspec pv-inverter module.
As reccommended by SMA I set the Modbus Unit-ID to 126 and the “Read from SunSpec ‘Common’ Block No.” to 40001.
But I can’t get any value from openems
I have the following warning:

[modbus0] FC3ReadHoldingRegisters [pvInverter0;unitid=126;ref=40000/0x9c40;length=2]

I have a step on the register to read and i think there’s a bug here.
the modbus worker start at 40000 and doesn’t take in account my parameter “read from Sunspec” ( readFromCommonBlockNo() function in the config file)
i don’t know where openeems takes this 40000 value


the “readFromCommonBlockNo” should be set to “1” normally. Also normally you should inherit from AbstractOpenemsSunSpecComponent and create your own bundle. Just like I did for SolarEdge.

SolarEdge was also the reason why I introduced that irritating “Read from SunSpec ‘Common’ Block No.” configuration setting. SolarEdges implementation of SunSpec is like ‘Common Block’, ‘PV-Inverter Block’, ‘Common Block’, ‘Grid Meter Block’ - so for the Grid Meter this config is set to “2”, as it should read only from the second Common Block.

Start address 40000 is where the SunSpec identifier is expected. This is checked before anything else in the isSunSpec() method.


I could finally connect to the SMA inverter.
But I have a bug in the interpretation of NaN value.
during the night, when I have 0W of production, the pv inverter sunspec module gives a -328k value.
it seems that it comes from the value given by SMA to NaN which returns 0x8000 for the INT16 type.

Hello Siden,

do you talk about the channel value of SymmetricMeter.ChannelId.ACTIVE_POWER?
The value is mapped 1:1. Therefore I wonder about the -328k value for the production. Is it a typo?
Because converting (UINT16) 0x8000 to (INT16) or (INT32) gives a value of -32768. So if it is not a typo, this could indicate another ElementToChannelConverter mapping (e.g. 10:1, which would lead to -328k).

Have you checked that the value is defined before using it?
Because if you call channel(SymmetricMeter.ChannelId.ACTIVE_POWER).getNextValue().isDefined() it should use the underlying implementation SunSpecPoint:PointImpl.isDefined() and this implementation already handles the 0x8000==NaN case and it should return false in your case.

Another possible reason could be the implementation of AbstractOpenemsSunSpecComponent:onSunSpecInitializationCompleted(). For ACTIVE_POWER it checks and uses the first sunspec point of the following models: SunSpecModel.S111.W, SunSpecModel.S112.W, SunSpecModel.S113.W, SunSpecModel.S101.W, SunSpecModel.S102.W, SunSpecModel.S103.W

Your sma inverter should use the model SunSpecModel.S101.W. Can you check, that the component is really using this model?