It seems to me that I have a problem that is unusual and does not occur with you - my GridFeedInPowerL1 is not receiving any data from the HM. The event log clearly shows that there is no event for GridFeedInPowerL1 in the log:
2024-02-13 09:19:31.454 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedPower' changed from 13.0 to 0.0
2024-02-13 09:19:31.455 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPower' changed from 0.0 to 6.7
2024-02-13 09:19:31.455 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedPowerL1' changed from 1478.5 to 1468.3
2024-02-13 09:19:31.456 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedEnergyL1' changed from 3942.739 to 3942.741
2024-02-13 09:19:31.457 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPowerL2' changed from 724.3 to 729.3
2024-02-13 09:19:31.459 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergyL2' changed from 7886.4346 to 7886.4355
2024-02-13 09:19:31.460 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPowerL3' changed from 741.2 to 745.7
2024-02-13 09:19:31.461 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergyL3' changed from 8062.3584 to 8062.3594
2024-02-13 09:19:32.995 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedPower' changed from 0.0 to 11.1
2024-02-13 09:19:32.996 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPower' changed from 6.7 to 0.0
2024-02-13 09:19:32.998 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedEnergy' changed from 2208.305 to 2208.3047
2024-02-13 09:19:32.999 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedPowerL1' changed from 1468.3 to 1459.0
2024-02-13 09:19:33.001 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedEnergyL1' changed from 3942.741 to 3942.729
2024-02-13 09:19:33.003 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPowerL2' changed from 729.3 to 715.4
2024-02-13 09:19:33.004 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergyL2' changed from 7886.4355 to 7886.429
2024-02-13 09:19:33.006 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPowerL3' changed from 745.7 to 732.6
2024-02-13 09:19:33.007 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergyL3' changed from 8062.3594 to 8062.3535
2024-02-13 09:19:35.605 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedPower' changed from 11.1 to 23.5
2024-02-13 09:19:35.608 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedEnergy' changed from 2208.3047 to 2208.311
2024-02-13 09:19:35.611 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergy' changed from 18780.59 to 18780.596
2024-02-13 09:19:35.611 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedPowerL1' changed from 1459.0 to 1818.1
2024-02-13 09:19:35.613 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedEnergyL1' changed from 3942.729 to 3943.5627
2024-02-13 09:19:35.613 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPowerL2' changed from 715.4 to 991.2
2024-02-13 09:19:35.616 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergyL2' changed from 7886.429 to 7886.863
2024-02-13 09:19:35.616 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinPowerL3' changed from 732.6 to 803.4
2024-02-13 09:19:35.617 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_PurchasedEnergyL3' changed from 1304.8967 to 1304.8969
2024-02-13 09:19:35.617 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SMAEnergyMeter_GridFeedinEnergyL3' changed from 8062.3535 to 8062.754
Do you have any idea why I am facing this issue?
Do you see any delays? Is L1 + L2 + L3 power equal to Total power?
What position are we talking about when you ask me if there is a delay? The inverter in its web front end shows everything correctly. The binding with its channels does not!
If I am to name a Total, it would be important for me to get the name of the channel of interest - e.g. GridFeedInPower (Total?)
In my case I can see in OpenHab:
powerOutL2 (Grid feed-in power L2) + powerOutL3 (Grid feed-in power L3) = powerInL1 (Purchased Power L1)
I am not a full blown Java specialist, but I hope you take my considerations into account when updating the binding. No problem to test any available update.
Thanks
@fcambron These are really good findings, I havenât noticed that isOpen check is not effective.
In regard to the fixes - if condition is fixed then we shall not need socket reuse flag, it is a signal for OS network stack to begin multiplexing of packets. Iâd rather attempt to do it on our end as we then could dispatch frames to proper handlers. The joinGroup call was previously in worker but it resulted in slow updates which you saw in your case. Probably it was due to accumulation of packets.
The frame parsing logic is older than my fixes, hence it misses for sure meter variants which come after 2020 (if not earlier!).
I saw new review comments from @Lolodomo, Iâll take care of them and also your findings within next build.
As far as I understand, the HM sends values for all defined channels every second, so I would assume that you should accept all these data records and store them in an âIn memory queueâ in the binding and determine an average value for a period of time (e.g. 5, 10, 20, 30 seconds), which you then output to the channels accordingly. As far as I understand, at the moment I only get, for example, one of 30 received data records, as the production values can fluctuate greatly within 30 seconds, the value is very volatile.
I would like to apologize if I am annoying you in the wrong place, I am just trying to make a helpful contribution - but I have to get into the subject first.
Iâve installed an IntelliJ and checked out the repo to look at the source code, but havenât had time to get it running yet. Is there a readme to get initial info on how to get it to fly - start the binding to access to subscribe to the multicast group?
What about extending the binding with http/rest requests to get data also from the SunnyWebPortal or the inverters itself?
When I searched for the integration of SMA products, I found something with developer APIs:
Are you familiar with this possibilities or could you do something with it?
The binding is indeed sampling the power values every 30s (default). As a result 29 out of 30 samples are ignored. The sampled value is only an indication of the power usage, and only more or less correct if the power flow is quite stable. Averaging all values might be difficult (I donât know if openhab is able to handle bindings at a 1 sec pace). Alternative could be to calculate the average as the (delta energy) divided by (delta time).
I you want to build the jar yourself. Install Java17 and Maven on your computer. Goto to folder:
âŚ\openhab-addons-IOConnector\bundles\org.openhab.binding.smaenergymeter
and run: mvn clean install -pl :org.openhab.binding.smaenergymeter
sometimes also mvn spotless:apply is required. If succesfull, you will find the jar file in the target folder.
More info on: https://github.com/openhab/openhab-addons
Updated binding should listen continuously but publish value only at configured ratio. This is a basic âdebounceâ mechanism to avoid spamming openHAB event bus with tens of events every second without possibility to control. There is no built-in sampling limiter within the distribution hence publishing every meter frame into bus would hit it quite hard. Even with persistence configured with every change strategy, you will get a lot of writes because, values such as voltage / power / current always change.
Thanks @fcambron for the confirmation, but I donât think Iâve explained my suggestion properly yet.
The binding, which is a java thread that runs, already gets the data every second, even if it were polling, that doesnât really make a load. The binding fetches the data every second into a âlistâ (cache, buffer, in memory queue âŚ) until there are as many entries as time is configured (e.g. 30 seconds). Then an average is calculated from the entries (algorithm per category?) and this value is delivered to OpenHab â Channel event!? This means that there are no more data records than before, but the quality of the information is better.
In the words of splatch âbasic âdebounceâ mechanismâ I would call my proposal an advanced decoupling mechanism
Regarding the testing of binding changes, you always do a build and deployment in OpenHab - canât you test directly against the HM from the IDE?
Maybe I will take a look at the dev API of SMA sometime and get in contact with them to evaluate what is possible. At the moment I have a heating system that the energy supplier shot down and that I now have to convert to Shellys and OpenHab
Hi Thomas
Not sure if it will work with 4.1. Worth to try it. Otherwise you can build the 4.1 version from the connectorIO repository and select the branch sma-fixes-4.1 + update the 2 .java files + rebuild.
If you have problems with it, just let me know. I will do it for you.
@fcambron I have added the binding this morning, but not able to find it after restart - nor in Inbox, search bindings ⌠- just found the official binding provided with OpenHab.
I assume the binding should appear in the Inbox after removing the Thing ("SMA âŚ)?
The logs do not show any error or warning, just Debug content.
So I gues the binding will not work with OpenHab 4.1!?
@Totomar On linux based system, you have to copy the jar file to /usr/share/openhab/addons
Best is to restart openhab as follows:
sudo systemctl stop openhab
sudo openhab-cli clean-cache
sudo systemctl start openhab
Once it is copied to that folder, it will appear under the âother Add-onsâ on the Add-on Store page:
All these screenshots are from the stable openHAB 4.1.1 release.
By the way, on which operating system is your Openhab running?
How many energymeter do you have in your network?
Are these SMA Homemager 2.0 or SMA Energymeter 20 ?
I run the OpenHab on a Synology NAS via Docker. There is no OpenHabian available (no openhab-cli), so I could not perform a clean cache. The OS on Synology NAS should be compatible with Ubuntu.
I have only one HomeManager 2.0 running in my network. There is an inverter for the production and an inverter the battery - that ´s it.
I think I did exactly what you wrote above - I installed the previous binding too, as I said the clean cache doesnât work - but Iâll try again to rule everything out!
When I wanted to get started, I tried to open the jar via Winrar, which also works with the original but not with your versions?
Then I looked at the sizes - why are they so much bigger - I have the feeling that the download files are damaged!
With the proper download I can use the new binding version - now I get values on all three âGrid Feed-in Power Lxâ lines, but the "Grid Feed-in Power L2 makes trouble.
This value jumps between 0 and the actual production value!?
After a while it has settled down - for the moment it looks good regarding production values - there is still a small gap I need to figure out what is missing!