[New Service] SMA SEMP Protocol - Addons/IO

No, I don’t.

Hey,

I recently installed a SMA Home Manager 2.0 and wanted to start load planning.
Thought I’d give your SEMP addon a try.

I’m running OH3.1.0M2 at the moment.
Added the addon in the addon dir.

Karaf shows it running:
“217│Active│80│3.1.0.202102071110 │org.openhab.io.semp”

Did put a generated UUID V4 into the Other Services > SEMP service and left ip and port settings to the default as I imagine they should be ok.

Debug log show:
2021-03-02 15:16:45.612 [INFO ] [openhab.io.semp.internal.SEMPServlet] - Started SSDP/SEMP Info service at /uuid:my generated uuid and /semp.

Trying to get anything, based on the examples, to show up on the SMA Home Manager, to no avail.

Any help would be appreciated.

Thanks in advance.

Hi,
try to set the ip to that one of the relevant network interface (where the SMA Home Manager 2.0 is inside , too) .

Hi Markus,

thanks for the reply. All devices are on the same subnet so that wasn’t the problem. Even the SEMP gateway did get detected by the HM2. Only the loads were not showing up.

Guess my brain was too tired yesterday and overlooked an error. There was a mismatch in the number format for power.

Now everything is working and I can focus on the load switching.

Hope this brilliant addon will at some point make it into the official ones.

Kind regards.

Hi Markus,

I’ve been testing your binding for a week now.
Everything worked fine up untill a network problem occured.
Now the semp binding still sends his communication but the Home Manager refuses to accept the device with the following warning message:

The device with the serial number XXXXXXXXX found by your Sunny Home Manager is already registered in another PV system and therefore can not be added to your PV system.

Is that serial number something that’s part of your binding?
Or is it something OH comes up with?
Do you have any idea where is that serial number defined in order to change it?

Because so far I’ve been trying to get it up and running again by changing the UUID in the binding, reinstalling the complete my OH test setup, setting up the whole test setup on a different machine and even using a different OH build.

Still the problem keeps existing.

For now I don’t even see where the problem originates from.
I thought I’d ask you while I’m trying to contact SMA support to see how I could get this “so called double registration” cleared on the sunnyportal website.

Kind regards

hi,
look to the group’s description in the first post (and in the example):

Tag: device_serial

There you can set it.

Ok, now I’ve got it too.

I had 2 problems, the first was my router or switch. After a restart, the devices appeared in the sunnyportal for configuration.
The second problem was, that after many tests I had several “dead” entries in the overview of new devices in sunnyportal. I couldn’t delete them by myself. I contacted SMA and was able to delete the devices after a few days. After the deletion, everything worked fine, the control of the devices and the display of the values.

And it works perfectly. Thanks for this great addon.

@Markinus
Do you have any plans to get this merged into the official addon repo?
I saw that you had an open PR in the past which was closed due to migration to OH3.

BTW: Do you know this project?

It also uses SEMP to integrate various devices into the Sunny Home Manager 2.0.

On 3.1.0-SNAPSHOT - Build #2387, I can’t load the addon because of unresolved dependencies to org.apache.commons.io:

  Unresolved requirement: Import-Package: org.apache.commons.io; version="[2.2.0,3.0.0)",
10:17:47.760 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.io.semp-3.1.0-SNAPSHOT.jar,
org.osgi.framework.BundleException: Could not resolve module: org.openhab.io.semp [330],
,
	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?],
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?],
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8],
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8],
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.8],
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.8],
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8],
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]

Is there anything I can do to get it to work?

UPDATE:
There’s an issue for the removal of this dependency as the library got removed from openhab-core:

I’m sadly not the java-guy. Is someone out there to keep this cool addon alive? :anguished:

Hi,
I’ve just uploded a new compliled version for OH 3.

Best
Markinus

Hi Markinus,

thank you so much for this great addon. It’s so cool to connect my OpenHAB smart home appliances with my SMA Sunny Home Manager and to see them appearing in Sunny Portal.

One of my main use cases for this addon is to monitor energy consumption for different devices. Let’s use an electric heater (for towels in the bathroom) as an example:

  • The heater is plugged into a power outlet which is controlled by my bus system, LCN, and the power outlet is configured as a “Switch” item in openhab. It can be turned ON and OFF.
  • Neither the heater nor the bus system can measure energy consumption.
  • The heater has a fixed power consumption of 900W if it is on and 0W if it is off.

My goal is to measure a power consumption of 900W in Sunny Portal while the heater (i.e. the LCN power outlet) is switched ON.

I have set up my stuff in OpenHAB like this:

Group SEMP_Heizung_Elternbad    "SEMP OH Heizung Elternbad"    ["Consumer", "semp:device_serial:HeizungElternbad20220217", "semp:max_power:900", "semp:earliest_start:60","semp:latest_end:120","semp:min_running_time:0","semp:max_running_time:1"] 

Switch  OG_Elternbad_Steckdose_Handtuchtrockner "Steckdose Handtuchtrockner"                <switch>        (OG_Elternbad, gSteckdosen, SEMP_Heizung_Elternbad)	[ "PowerOutlet" ]       {channel="lcn:module:RaspiPCHK:M089:relay#1"}
Number SEMP_Heizung_Elternbad_Power "SEMP OH Heizung Elternbad Leistungsaufnahme [%s]" <energy> (SEMP_Heizung_Elternbad)

And the following rule to set the “fake” energy consumption:

SEMP_Heizung_Elternbad_Power.sendCommand(new DecimalType(900))

I theory, this works and I see the device in Sunny Portal, I can add it to the list of devices and even some basic monitoring is working: If I switch the device ON I can see the current energy consumption in the “live” view of Sunny Portal.

However there are still some problems:

  • I can see that the heater is turned ON by Sunny Home Manager during the day (and even during the night). I played around with the “min_running_time” and the other parameters, so the above might work already better.
  • I don’t see the aggregated power consumption for the heater in the “day” view.
  • I tried to add my Freezer with the same approach which is ON 24/7 but I still don’t see the energy consumption for the whole day.

My questions:

  • There is an option “Energy monitoring (measuring only)” for devices in Sunny Portal. E.g., my Fritz Dect Power Socket is configured that way. I think this would perfectly suit my use case. Do you think you can enhance your plugin to also support devices for measuring only?
  • If not, what is your suggestion to configure my devices with SEMP parameters to not be activated by Sunny Home Manager at all?
  • Any ideas why I can’t see a reliable energy consumption value for my freezer and also for the heater in the “day” view but only in the live view?

Thanks again
Maschine

Hi @Markinus,

thank you very much for the 3.0 compilation.

I’ve noticed the binding does not work, if the Number item is defined as Number:Power and the power consumption contains Units of Measurement (e.g. “300 W”).

The log then contains

11:16:03.263 [qtp1584377944-4936] ERROR org.openhab.io.semp.internal.SEMPItemCommunication - Item is not from DecimalType type ,
11:16:03.265 [qtp1584377944-4936] ERROR org.openhab.io.semp.internal.SEMPCommandServlet - Error in item determination

Could you please just strip the UoM on the Number item so the binding is simpler to use.

Thank you very much for your glorious effort! Very much apprechiated!

Best,
Sascha

Finally some SEMP integration! Thank you!

Only thing is, I can’t get it to work on OH3. I’ve downloaded the package for OH3 and extracted the package to:
C:\Program Files\openhab-3.1.0\addons\org.openhab.io.semp

But it’s not picked up somehow…
I already did a system:shutdown -r for a restart but that doesnt help either.

Best regards,

Seriously, is this binding already dead?

You don‘t need to extract the jar file, just copy it to your addons folder.
It will not show up in the UI as installed binding, but in Things hitting the plus symbol should list it as an option.

Yes, of course…

And how to remove it? Just removing it from the openhab\addons folder doesn’t remove the (complete) addon. It’s still alive, even after service restarts.

Best regards,

You might need to clean the cache after deleting.

Seems that I needed to wait longer for services to shutdown? Is that possible?

What I experience is the following with the SEMP implementation:

I have the sunny home manager 2.0 as the SEMP gateway, connected to sunny portal.
Next to that I have the Mennekes AMTRON Professional EVcharger connected using SEMP.
The SMA solar system regulates the charger to have a ‘basic’ charge power (30%), and additional with solar power (if available) upto 70% (+30% = 100%).

If I run openhab with the SEMP addon, it ‘takes over’ my charger by registering its service.
I can monitor the SEMP ‘master’ changing from the sunny home managers IP (x.x.x.202) to the IP-address of the openhab instance (x.x.x.2).

Is the SEMP addon a ‘controller / gateway’ application?

Best regards,

I’d like to report a bug from my point of view:
The binding supports Number items but not items with UoM f.e. Number:Power.

That’s really sad as it messes with my configuration. If I change my Number item to Number:Power I get this in the logs:

18:50:28.656 [DEBUG] [enhab.io.semp.internal.SEMPUpnpServer] - Got SSDP Discovery packet from 10.0.0.250:1900
18:50:28.684 [WARN ] [p.binding.xml.ServiceDescriptorBinder] - Could not parse service descriptor: org.jupnp.xml.ParserException: org.xml.sax.SAXException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 3; Markup im Dokument vor dem Root-Element muss ordnungsgemäß formatiert sein.
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 3; Markup im Dokument vor dem Root-Element muss ordnungsgemäß formatiert sein.
18:50:28.690 [WARN ] [np.protocol.RetrieveRemoteDescriptors] - Device service description failed: (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:8e75f1cc-848e-40ca-b7ec-87367019bd09, Descriptor: http://10.0.0.250:8080/uuid:8e75f1cc-848e-40ca-b7ec-87367019bd09/description.xml, Root: true
18:50:28.694 [DEBUG] [enhab.io.semp.internal.SEMPUpnpServer] - Data: NOTIFY * HTTP/1.1

Is there any way to change the binding?

Thanks very much
Sascha