[New Service] SMA SEMP Protocol - Addons/IO

I wrote a SEMP service for OpenHab and it would be great if someone would test it. Depending on how many people are testing it I would try to get it to the default installation. I share the software under the Eclipse Public License . openhab2-addons/LICENSE at master · openhab/openhab2-addons · GitHub.

Download OH2.5: org.openhab.io.semp

Download OH3: org.openhab.io.semp


openHAB SEMP Service

This service implements the SEMP protocol for openHAB


  • UPNP automatic discovery
  • Full SEMP Support
  • Support ON/OFF and Decimal item types


After the activation of this plugin and the configuration it (e.g. in PaperUI) and of the consumer(s) the upnp service will start immediately. After some minutes you can start a device search in the SMA Sunny Portal. It will detect the device(s) and you will be able to add it to your device list.


An UUID (Universal Unique Identifier) is a 128-bit number used to uniquely identify some object or entity on the Internet. Usually it’s a mac and time based V1 UUID but it is possible to use a random generated UUID, too. There are some generators in the internet available.
Important: if you change it then you have to recreate the consumers in SMA Sunny Portal.


(Optional) For systems with multiple IP addresses the IP to use for UPNP may be specified, otherwise the first non loopback address will be used.


(Optional) Some SEMP applications require a different port (80) then what openHAB runs on by default (8080). This option will only advertise a different port then what we are listening on. Useful if you have an iptables rule redirect traffic from this port to the openHAB port.


Persistence (Optional)

Usually this plugin will send the devices status every minute. But there is the possibility to send values up to the last 10 minutes, too. If you want to use this feature then you have to configure persistence for this item. If your persistence is supporting a step smaller then one minute then this plugin will determine additional values like min, max or average from the last 60 seconds.

Device Tagging

The SEMP service supports multiple consumers. Every SEMP consumer needs up to four items mapped inside one group. These items are a switch item (on/off) for device controlling, a number item (power), an optional contact item for the “Connected” state and an optional contact item for the “Listening” state.
The identification of a SEMP consumer is a group-tag [“Consumer”]. The identification for the consumers items is a tag with the name of the consumers group.
These “contact” items has to be tagged for identification, too. Use the [“Connected”] tag for the indication whether the consumer is connected (like a car on an EVCharger) and the [“Listening”] Tag for the indication whether the consumer is listening to the SEMP commands. (e.g. you should set it to open if you are charging a car manually without SEMP).

Consumer Configuration

The consumer need some configuration parameters. This parameters are tags for the group item, too.

All tags are formatted like this:


For example:


If you’ve defined your Items in .items files, tags can be added using:

[ "mytag" ]

syntax (after the (Groups) and before the {channel}).
If you created your items another way, e.g. using the Paper UI, HABmin allows you to modify the tags.

Tag: device_id

The device ID is represented by a 92 bit integer which consists of the following components:
Device ID (92 bits):

Vendor ID type (4 bits)  + Vendor ID (32 bits)  + Serial-number (48 bits) + Sub-device ID (8 bits) 

Required: no

Default: auto-generated from consumers name



Tag: device_vendor

Name of the device’s vendor.

Required: no

Default: Unknown



Tag: device_type

Type of device. One of the values predefined in the SEMP XSD should be used:


Required: no

Default: Other



Tag: device_serial

A serial number that is known by the user so that he is able
to identify the device. If available use the vendor specific serial number which is printed on
the device.

Required: yes



Tag: max_power

Maximum power consumption of the device (in W).

Required: yes



Tag: min_off_time

When switched off (or paused), the device has to remain off for at least the given amount
of seconds.

Required: no

Default: 0



Tag: min_on_time

When switched on (or un-paused), the device has to remain on for at least the given
amount of seconds.

Required: no

Default: 0



Tag: inter_alowed

Specifies whether the device can be interrupted (paused) during runtime. This
allows a more flexible energy management for the device. For instance the EM
can interrupt a device in case of unpredictable bad weather conditions or when
the user switches on a device with conflicting energy needs and restart the inter-
rupted device afterwards.

Should be set to “true”. Set to “false” only if the device operation cannot be
paused, e.g. for some program based devices.

Required: no

Default: true



Tag: earliest_start

Specifies the earliest start time [in minutes from midnight] of the device.

Required: yes


600->every day at 10am

If you want multiple time frames then you need to separate them with":"


Tag: latest_end

Specifies the end of the planning range. This is the latest possible time the device opera-
tion has to be finished. [in minutes from midnight]

Required: yes


660->every day at 11am

If you want multiple time frames then you need to separate them with":"


Tag: min_running_time

The minimum amount of time the device needs to run in the time range specified by Earli-
estStart and LatestEnd. It will be assigned to device by the EM even if there is no PV-
production so that grid-energy has to be used to power the device. Note: If set to “0”
all of the energy is optional and should only be allocated to the device if certain
conditions are fulfilled (e.g. cheap PV-energy available). [in minutes]

Required: yes



If you want multiple time frames then you need to separate them with":"


Tag: max_running_time

The maximum amount of time the device needs to run in the time range specified by Earli-
estStart and LatestEnd. The difference between MaxRunningTime and MinRunningTime is
the optional runtime that can be assigned to the device by the EM if cheap energy (e.g.
excess PV-energy) is available. [in minutes]

Required: yes



If you want multiple time frames then you need to separate them with":"


Tag: days_of_week

Some consumers didn’t have to run every day. Meybe only on the weekdays or on the weekend. With this parameter it’s possible to set the relevant days of the week. These days have to be set in short format, Mon, Tue, Wed, Thu, Fri, Sat, Sun.

Required: no



If you want multiple days then you need to separate them with":"




Group PwrSwitchMedia    "PowerSwitchMedia"    ["Consumer","semp:device_serial:abc123456789","semp:max_power:1400","semp:earliest_start:600","semp:latest_end:1000","semp:min_running_time:0","semp:max_running_time:300"] 

Switch Media_Switch   "Media center switch" (PwrSwitchMedia) { knx="<3/1/4" }
Number Media_Power    "Media center power" (PwrSwitchMedia)  { channel="edimax:sp2101w:29a0126d:power"} 

Contact isListening "Consumer is Listening" (PwrSwitchMedia)  ["Listening"] 

New version with support for “Connected” and “Listening” contact items and a new group parameter “days_of_week”.

Fixed links, some small bugfixes, OH3.0 Version

New compiled version for OH 3



i get installed my SMA-solar in the next days and very interessted in this service.
Did anyone tested it yet?


Can you perhaps describe in a little more detail how I have to install the binding?

Just copy it into the addons folder.

Unfortunately the download link is not working anymore. Could you please share a new link?

I am highly interested in the addon. :slight_smile:

Hi Markus,

I’m also interested in the new version with support for “Connected” and “Listening” state.
The download link is not working, can you please upload the current version?


I just fixed the links in the first post and added a version for OH 3.0.


I copied the version for OH2.5.
The service is enabled. I set the UUID in PaperUI.
Create the items like your example, but I can’t see any log information from semp
and when I start to search for devices in the sunny portal, it find nothing.

Any ideas, what is going wrong??

can you see this in the logfile?

2021-02-21 11:09:32.670 [INFO ] [openhab.io.semp.internal.SEMPServlet] - Started SSDP/SEMP Info service at /uuid:abcd1234-1234-ffff-aaaa-000000000000 and /semp.

Usually it should work, maybe a problem in the configuration.

There is no entry like this in the logfile.
Did i something wrong with the UUID? I generate a random uuid from a website.

In the karaf console the service is listed.
After stop and start the service, there are no entries in the log.
Reboot the rpi, doesn’t help.
OH Version is 2.5.10-1 (release build)

I have a similar problem as cjoschui.
I used the OH3.0 addon at my openhabian installation. The service is enabled, too.
In my case I can see the entry in the logfile, but the result is the same.
It does not find any device at the sunnyportal.

I also used your examle (PwrSwitchMedia) for the first try.

@cjoschiu: Have you added tags with the name of the consumer group to the subitems?

Hmm that’s strange. Here it works without any problems, this is my config:

Group WallBeSMA    	"Wallbe-Wallbox ECO 11kW"    ["Consumer","semp:device_vendor:wallbe","semp:device_type:EVCharger","semp:device_serial:012-01234-12-12-123","semp:max_power:11000","semp:earliest_start:180","semp:latest_end:1430","semp:min_running_time:180","semp:max_running_time:720"] 

Switch WBLadevorgangFreigeben		"Ladevorgang freigeben [%d]"  						(gWallbe, WallBeSMA)  	{ channel="modbus:data:wallbe:wb_coil_400_11:wb_400:switch" }

Number WMWirkleistung	 			"Durch. Wirkleistung [%.2f W]"   					(gWallbe, WallBeSMA)  	{ channel="modbus:data:7KT1665:wm_input_34_32:wb_58_2:number" }

Contact WMCarConnected				"Auto ist angeschlossen [%d]" 						(gWallbe, WallBeSMA)	["Connected"]

Yes i tagged the switch and a number item with the consumer group.

I edited the posting above and added the other channels. It is simmilar to yours?

Group       gSteckdoseKuehlschrank    "PowerSwitchMedia"    ["Consumer","semp:device_serial:tuya4147","semp:device_type:Fridge","semp:max_power:1400","semp:earliest_start:600","semp:latest_end:1200","semp:min_running_time:300","semp:max_running_time:800"] 

Switch      SteckdoseKuehlschrank                             "Kühlschrank-Steckdose"                                                      <power> (gSteckdoseKuehlschrank){ channel="mqtt:topic:Mosquitto:tuyaplug4147:Power" }
Number      SteckdoseKuehlschrankPower                          "Verbrauch Insgesamt"                                                       (gSteckdoseKuehlschrank) { channel="mqtt:topic:Mosquitto:tuyaplug4147:TotalPwr" }```

Do i need the contact item or is it optional?

Connected and Listening are optional.

Do you use hue emulation?

I’ve created a second device in the config and it was detected without problems.

If it’s still not working then activate debug for this binding and send me the logfile including initialization.

I set the logging Level to debug for

Is that correct?
Because I set it already to debug, but there are no debug entries in the Log.

OK, I got it.

I add the uuid to the runtime.cfg file.
After that the service starts and the sunny portal found the tagged device.

GREAT. IT WORKS. I’m so excited.

Thanks for the support.