Error when connecting the edge to backend

Hello,

I’ve simulated an edge and one backend, and i configured the controller API backend on port 8082, controller API websocket on 8085 (on edge configuration) and UI websocket on port 8085 (backend configuration).

when accessing the backend UI, i get connection established, there’s no edge showing on the page and when inspecting the page i get “connection to localhost:8082 failed”

please help as I am new to OpenEMS.
thank you!

EDIT: when simulating the edge, i get this message as well
<< [Worker-0] WARN [socket.AbstractWebsocketClient] Unable to send JSON-RPC message. WebsocketNotConnectedException: {“jsonrpc”:“2.0”,“method”:“timestampedData”,“params”:{}} >>, i think it’s the same issue (can’t connect with 8082)
can anyone explain what that port does?

I tried changing the port 8082 to 8077, and i still get the same issue: “Websocket connection to ‘ws://localhost:8077/’ failed”

Hi Ghada,

if you follow the Getting Started guide under Getting Started :: Open Energy Management System at 6. Integrate OpenEMS Backend it should work out.

Just make sure, that the port at Backend Edge.Websocket (here 8081) matches the configuration of Edge Controller Api Backend (here ws://localhost:8081) and you should get a connection.

Regards,
Stefan

1 Like

Hello Stefan,

I followed all the steps on the documentation page, and the Edge.websocket is configured on 8081as well as the controller API Backend (localhost:8081), it still doesn’t work.

Hi Ghada,

just to be sure:

  • both OpenEMS Edge and Backend are running on the same Computer (e.g. inside Eclipse IDE)?
  • Controller Api Backend Uri is configured for ws://localhost:8081 as shown in this screenshot? The ws:// is important, otherwise it won’t work.

Regards,
Stefan

Hello,

  • yes, both the backend and edge are running on Eclipse IDE
  • the URI is configured for “ws://localhost:8081”

When starting BackendApp.bndrun, do you also see this log?

io.openems.common [io.openems.common.websocket.AbstractWebsocketServer] INFO : Starting [Edge.Websocket] websocket server [port=8081]

The EdgeWebsocket component has References to Metadata and Timedata and if you forgot to start andy of those, the EdgeWebsocket will also not start. In general the Getting Started guide should really work, me and some now colleagues of mine just tested it a few days ago successfully.

1 Like

I do have Metadata (with the path to the .json file configured) and the timedata both configured, yet when starting the Backend i don’t get that log.

You need to have one instance of each core backend service: Timedata, UiWebsocket, EdgeWebsocket and Metadata.

I just tried following example successfully:

  • Edge.Websocket
    • Port: 8081
  • Ui.Websocket
    • Port: 8082
  • Timedata.Dummy
  • Metadata.File
    • Path: “metadata.json”

Note: a created the following metadata.json file:

{
   "edges":{
      "edge0":{
         "comment":"My first OpenEMS Edge",
         "apikey":"unique_password_for_edge0",
		 "setuppassword":"edge0"
      },
      "edge1":{
         "comment":"My second OpenEMS Edge",
         "apikey":"unique_password_for_edge1",
		 "setuppassword":"edge1"
      }
   }
}

It differs from what I had posted here (Connect edge instance to backend - #2 by stefan.feilmeier) in the additional setuppassword. Unfortunately it seems this is caused by a Merge error. That setuppassword field is not relevant to you… it will be used by this pull-request once its merged: Implementation of an installation assistant by raphael-piller · Pull Request #1588 · OpenEMS/openems · GitHub

Regards,
Stefan

1 Like

Hello Stefan,

I think the issue was with my websockets all along (websocket 8082 to be exact), because I tried to run a backend and an Edge on an EC2 instance and the connection worked perfectly.

Thank you for all your help
Gratefully,
Ghada

1 Like