Connect multiple Edge instances to one OpenEMS backend

Hi, Im currently trying to connect multiple instances of OpenEMS edge to one OpenEMS Backend.

The Backend is hosted via Eclipse on http://localhost:8079/. I have on instance on Edge running on Eclipse, one on my Raspberry Pi and one in a Docker container. They all work fine. However, if I want to connect them all via the “Controller Api Backend” to my one Backend instance, only one gets detected in the UI or in InfluxDB. I think the reason is because every Edge device gets named “edge0” on startup and thus it only can show and detect one at a time. I tried to find a configuration or something where I can change the naming of each Edge device, but I could not find anything.

Is there a way to connect multiple instances of Edge to one Backend and if yes, how can I change and configure the single instances so that I can watch them all over my backend?

Regrads Patrick

1 Like

Hi Patrick,
you can connect multiple edge instances to one OpenEMS Backend. You need a proper Metadata Bundle activated on the backend site. The Metadata Interface handles authentication and identification of any edge and also of any user, which connects to the OpenEMS Backend. As your edge devices always get edge0 you probably have activated the “Metadata.Dummy” bundle. This bundle will allow access for every user and every edge, but all edges will get the ID edge0.
You may try to use Metdata.File. In the documentation you can find a basic configuration file for it. As you can see you can configure multiple edge IDs and also their corresponding apikeys (important).

Below are the steps to configure two edges and one backend to work properly:

Backend Configuration:

  1. Open Backend Apache Felix Web Console
  2. Delete Metadata.Dummy configuration or any other Metadata… configuration
  3. Add Metadata.File configuration and provide a path to a json file holding the configuration (as in the example above). Remember the apikeys (Note: they must be different for each edge)

Edge 1 configuration:

  1. Open Edge Apache Felix Web Console
  2. Prepare a new or open an existing “Controller Api Backend”
  3. Configure the Controller (URL, componet-ID, and most important the apikey).

Edge 2 configuration:
Same as Edge 1, but with a different apikey

Thats it. You should be able to see multiple edges now. Of course you can also use the other Metadata bundle.

Note 1:
Personally I have never used Metdata.File. So I am not sure if the above steps are sufficient. But it should give you a hint, how to start on your issue.

Note 2:
For anyone interested. We are working on a Metadata.Keycloak implementation. It is not yet published, but hopefully we will do this soon.

Hope this helps,

1 Like

Hi Chris thanks for the fast answer!

I already tried the Metadata.File approach and just did it again with the exact config file from your example.
In the Metadata.File:

The Metadata.json:
“edges”: {
“edge0”: {
“comment”: “Edge #0”,
“apikey”: “edge0”
“edge1”: {
“comment”: “Edge #1”,
“apikey”: “edge1”

In the “Controller Api Backend” i just changed the apikey according to Metadata.json but I still get connection refused:

Did I miss something?

Hi Patrick,
sorry, I can’t see any obvious problem from your json configuration or from your logoutput. In such a situation I would probably now start debugging the code. I would start with the backend and place some breakpoints to get a better understanding. First I would check if the Metadata bundle was able to parse the json file. Therefore I would walk through FileMetdata:refreshData(() .

If this works fine, you could place some breakpoints around the Websocket and see what happens, when an Edge wants to connect. One of the first methods which should be called is OnOpen:L26. You could place a breakpoint and see what happens.

Hope this helps,

+1 #Keycloak as IAM backend

Hi Patrick,

OpenEMS will discriminate your edge nodes by their provided apikey (in the Metadata.Dummy implementation).
Reconfigure your “Controller Api Backend” on your edge devices and provide two seperate apikeys - just use some random Strings.
This should do the trick for your test-setup.