Hardware implementation

hello openEMS Community.
I have a Shelly EM meter that sends data to a specific IP address through its interface. This meter is equipped with a data reception and control interface. Now, I am looking to integrate this device into openEMS. My objective is to efficiently receive data from the Shelly EM in openEMS and effectively command the meter, leveraging its contactor control functionality. I would greatly appreciate any assistance or guidance you can provide in achieving this integration.


I also run some Shelly devices privately (Shelly Plug S and Shelly 2.5).

When you say “sends data to a specific IP address through its interface” - which protocol are you referring to? Is it MQTT?

The way the Shellys are currently implemented is via local HTTP API. You can find the implementation here, which might already work with the device you have:

There are also multiple developments for Shelly by different people in the pipeline and might be interesting to you:


Thank you very much for your assistance. Based on my understanding, it seems that the device in question is utilizing MQTT. I currently possess the device, and my goal is to establish a connection with openEMS. Unfortunately, I am unfamiliar with the process of linking the device to openEMS. Would you be so kind as to provide me with some guidance or instructions on how to accomplish this task? Your help would be greatly appreciated.
Below, you will discover both an image of the device and the corresponding web interface page.

when I use the the bundle that you give me look what the console display

2023-08-03T10:53:30,567 [_cycle ] ERROR [shelly.shelly25.IoShelly25Impl] [io0] Unable to read from Shelly API: Index 1 out of bounds for length 1

The error you see is thrown in this Code-Block:

As you can see, this block implements the API for Shell2.5, see the official documentation:


You would have to specifically implement the EM meter similarly (or adjust the above code block) to parse the response correctly. See the docs for Shelly EM:


In fact, it looks like the API for Shelly EM is very similar to the Shelly Plug, which is also supported by OpenEMS. You might just give it a try.


s o I have to implement the device from 0??
it is so hard for a beginner ?

Well, as I said: it looks like the API of the Shelly EM Meter is very similar to the one of the Shelly Plug, so it could possibly work out of the box with the OpenEMS Shelly Plug Component.

In rest: unfortunately the Shelly EM is not directly supported by OpenEMS by now. It’s not quite our fault, that each Shelly device has a different API interface. And nobody in the Community has yet implemented it. Sorry. But with the guidance I had given above, it should be not too complicated to copy, paste & adjust existing code to get the right data.

(We also installed a few Shelly EM devices here at FENECON, so we will most likely make an implementation ourselves, soon. But there is no concrete deadline, yet)


1 Like


please try my own implementation. It is pretty bad coded i guess but it works on my local EMS with Shelly Plus1PM Gen2.

BTW: @stefan.feilmeier there is a Gen1 and a Gen2 Shelly :smiley: this could be te Problem! :slight_smile:

Add this to your ShellyApi.java:

 * Gets the status of the 2nd Gen Shelly Device.
 * <p>
 * See https://shelly-api-docs.shelly.cloud/#shelly2-5-status
 * @return the status as JsonObject according to Shelly docs
 * @throws OpenemsNamedException on error
public JsonObject get2ndGenStatus() throws OpenemsNamedException {
	return JsonUtils.getAsJsonObject(this.sendGetRequest("/rpc/Shelly.GetStatus"));

note that the shelly is ±9% of the measurement :wink:

Greetings !