SMA Energy Meter Binding yields unplausible values

How often does this happen?
The message means, that the socket wanted to receive a packet but didn’t got a response during the timeout period (script line 330: mcr.sock.recv_into(packet)). I use a 500 ms timeout (script line 297: self.sock.settimeout(0.5) ). In the default configuration the HM sends a packet every 200 ms. So 500 ms give enough time to receive a packet and do a retry if the packet ID is wrong.
Nevertheless depending on network traffic it may happen from time to time that packets got lost. I see this usually 1 - 5 times in 24 hrs.
If the error appears frequently, it could be that your default configuration of your home manger has been modified. You can check the transmit interval in the Sunny Portal under ‘Sunny Portal / Konfiguration / Geräteübersicht / Home Manager / Eigenschaften / Zählerkonfiguration / Messintervall internes Energy Meter’. Here you should configure the 200 ms mentioned above.

Thanks, @tomE for your quick response.

The message appears every 3 seconds.

I’ve just checked the configuration - for some reason, it’s set to 600 ms.

So I only need to alter it to 200 ms, right?

Maybe you could tell me what “PV-Erzeugung” means - what will happen when I change it from “kein Zähler” to “Internes Energy Meter”?

For an interval setting of 600 ms the socket timeout of 500 ms is to low. There is a high probability that you won’t get a packet in this timeframe. Either increase the timeout or decrease the interval setting.
If you click on the ‘Bearbeiten’ button below ‘Zählerkonfiguration’ fields you can change the measurement interval. There will also appear an additional info button in the ‘Messintervall’ field where SMA recommends to set the value to 200 ms.

Regarding ‘PV-Erzeugung’ I have no clue. I didn’t care since the option ‘Internes Energy Meter’ is greyed out in my configuration.

1 Like

@tomE
Many thanks! It works like a charm now :slight_smile:

Hi

I have just installed openHAB 3.3 with SMA binding and am also seeing occasional strange readings. 4-5 times an hour the Purchased Power gives a value of -205186656 which is not only rather large but also negative. I have a workaround by creating a new measurement point and a rule to only update it if the purchased power is positive.

Have all fixes mentioned about been included in the current download which shows version 3.3 on the bindings page? All the other power values, feed-in total and all the phases seem sensible with no negative values.

PJG

PJG

Hi,

the SMA Binding hasn’t been fixed up to now. The current version doesn’t check the protocol id of the SMA multicast packets. Starting with Sunny Home Manager Version 2.07.5.R SMA has added an additional packet with completly different content. The two packets can be distinguished by the protocol id.
And don’t be mislead, all! readings from this packet are wrong and must be discarded.

Thanks for the update. I am not sure how to check the protocol id, as I am just using the UI, not the text or file based stuff. My rule skips all the SMA values if the Purchased Power is negative so should be OK. If none of the fixes have been added to the release version, I can see why I had an earlier problem with a second energy meter that measues the power from my PV system. The binding was mixing vales from both the Home controller and the Energy meter, even though they were installed as seperate things.

Do you know when the relase version will be updated to include all the fixes. I will happy to test my system again when the update is released.

PJG

With the current binding you can’t check the protocol id. One option is what you already do: Check for unplausible values like the negative power value in a rule.
The other option is to use the python script I have published in (32). See the explanations there.
For an updated version of the binding first of all someone must volunteeer to change the code.

I am sorry but I cannot help with changing the binding code as it is beyond my skill level. I will continue with the rule based approach that work OK, except for the fact that I cannot access the second meter which measures the PV power. I do have an alternative way of measuring PV output, so I will that instead.

PJG

I have a similar problem. I do not receive any data from my SMA Energy Meter. In Wireshark do see regular UDP messages from the SMA Meter to 192.168.1.255 (Port 9522). It seem to be a kind of multicast (I am not a network expert), instead of the default multicast address. When I try to change the default multicast address of the binding to 192.168.1.255. I receive an error that this is not a multicast address. Can someone help, I really need the information of the meter.

Please provide more information otherwise no one can help you.
Which system / software are you using (OS version, openhab version, binding etc).?
Does ’ I do not receive any data’ mean you do not even receive data in the sunny portal ?
What SMA energy meter are you speaking about?
How does your thing configuration, item definitions and rules look like?

Sorry, you are right, here are some more information:

  • Hardware: RaspberryPi 4 with 1GByte
  • Openhab Version: 3.3.0
  • SMA Binding: 3.3.0
  • Converter: SMA Tripower 10
  • Sunny Portal: Works normal, I can see generate energy, cunsumed energy etc.
  • SMA Meter: Home Manager 2.0

The SMA solar system and the openhab installation are brand new. Apart form the SMA Binding everything works quite good with openhab (e.g. Shelly bindings).

I left everything in default configuration within the binding (broadcast address and port). Afterward I just added a thing by UI and added a channel to an item. The result ist, that the thing goes into “CONFIGURATION_ERROR java.net.SocketTimeoutException: Receive timed out” and the item usually says NULL. I have realy tried a lot (activating, deactivating, fresh openhab installation etc.). Sometimes the thing goes to “Online” but the received data is wrong.
I have no idea what to do.
Kind regards
Heiko

Hi

I have a similar configuration, but running OH 3.3 on Windows with the SMA Binding 3.3. My SMA hardware is

SMA Home Manger 2.0
SMA Energy Meter between my older (non SMA) PV inverter and my network

As far as I understand from this thread. the current binding does not correctly distinguish between different types of messages or between different SMA devices. I can access the SMA Home manager on its own providing I use a rule to reject bad readings. However if I also create a second thing for the energy meter, then the readings are totally confused.

I think we may have to wait until someone with coding skills can fix the binding so that it can deal with multiple devices without error.

PJG

Just to be clear. I can only get the SMA Home Manger to work if the Energy meter is NOT connected to the network. You could try deleting the Thing for the Tripower and also disconnecting the SMA Tripower from you network and see if you can access the Home Manager on its own.

Sounds good since it proofs that your PV system is working in general.
Unfortunately I don’t use the binding any longer, instead I use my phyton script to query the home manager. But before you try to start with the python script I recommend to bring the binding into a working condition in the first place. The python script could be the next step to get rid of the messages with the wrong protocol ID.
You are saying you left all as default when you configured the binding. But did you check the information box above the configuration box in the UI? The serial number must be that of your home manager.

The default values for multicast group and port are correct.

What do you mean with ‘energy meter’, obviously not the home manager? Disconnecting the solar inverters from the network doesn’t make any sense, this will only cause unnecessary error messages in the sunny portal. The solar inverter and the home manager together build the local PV system, so having the inverter connected to network shall not have any negative impact on the home manager.

This is so crazy. I have not changed anything and currently it is working, no idea why. The Thing is online and the Items show correct values. The serial number is now similar to your screenshot -128****** but that is not the correct number (may be it is a faulty interpretation of the number), but you can not set the serial number in the GUI, but I defined it in the file based version.

Sorry, I was not clear.

I have an SMA Home Manger 2.0 before my utility meter which measures power to and from the grid. I can connect to this with the binding and rules to remove the error readings. My inverter is 10 years old and was not made by SMA, so I bought an SMA Energy Meter and placed it between the inverter and my house distribution box to measure the solar power. It, like the SMA Tripower, broadcasts its power readings over the internet connection.

What I found was that if both the Home Manger and the Energy meter were connected at the same time on my network, then the binding would give errors and sometimes faults. I have now removed the SMA Energy Meter and replaced it with a Btinico Power meter so I can now measure the power comming from my PV array.

My suggestion to remove the SMA inverter from the network was an experiment to try and isolate the problem. It is clear that if the SMA binding is not properly decoding either the message type or which SMA device the message came from, then it is not a working solution.

I would like to get this fixed if I can, as I have a second installation which has an SMA PV Inverter, an SMA Battery inverter and an SMA Home Manager so I would have no chance at all of making this all work until the binding is fixed.

PJG

I found the root cause for my initial problem, where I received an error and no values at all, not even sometimes. The reason is a network rounting problem and has nothing to do with openhab or the binding. I have recently bought a second unmanaged switch and I have a fritz.box as network router to the internet. Two ethernet ports of the fritz.box are each connected to one of the unmanaged switches. The problem is, that the SMA stuff is connected to the first switch and the openhab Raspberry is connected to the second. That means, the fritz.box has to route the SMA meter multicasts over the fritz.box to the other switch, and exacly this is not happening. Yesterday, I “accidently” connected them together and then it worked.

However, I also receive now and then wrong values.

Congratulations, now your are in a condition where this thread applies :slight_smile:
Side note: SMA strongly recommends to use managed switches which allow to turn off IGMP snooping which is usually the root cause for this problem. Unmanaged switches often do IGMP snooping by default.

You have now the option to filter the wrong values. The wrong packet has the serial number located where the binding expects the value for powerIn. So unplausible values on powerIn are a reliable indicator that the binding received the wrong packet. Please be aware that in this case you have to discard all item values you have defined for the home manager.