Internal Component Communication

This page describes the internal communication protocol between OpenEMS Edge, OpenEMS Backend and OpenEMS UI. The components keep an open Websocket connection which is used for bi-directional communication. The protocol is based on JSON-RPC. For details about JSON-RPC please refer to the specification. As a rough summary, the protocol is divided into

JSON-RPC Request

Identified by a unique ID and method name with specific params. Expects a Response.

JSON-RPC Success Response

Referring to the ID of the Request, providing a result which can be empty or hold specific data.

JSON-RPC Error Response

Referring to the ID of the Request, providing error code, message and optionally data.

JSON-RPC Notification

Identified by a unique method name with specific params. Does not expect a Response.

The information on this page is useful to understand the internal communication structure and can help if your plan is to replace one component by a custom implementation, e.g. implementing your own frontend application, or if you plan to extend the provided feature-set.

1. Authenticate UI to Edge/Backend using token

On opening of the websocket connection to Edge/Backend, the UI is authenticated using an existing token.
authenticateWithSessionId

2. Authenticate UI to Edge using password

authenticateWithPassword

3. Subscribe to Channels

Allows a Component to subscribe on certain Channel values. The latest Channel values are then periodically sent.

subscribeChannels+currentData

4. Subscribe to System-Log

Sends the log output of Edge to UI via Backend.

subscribeSystemLog

5. Store channel data in Time-Series database

Edge Backend Api-Controller periodically sends data of Channels to Backend, where it is stored in a Time-Series database (like InfluxDB) via a Timedata service.

6. Communicate with a specific Edge Component

This provides a way to send a JSON-RPC Request directly to a specific Edge Component identified by its Component-ID - e.g. to a specific Controller. To enable this, the Edge Component needs to implement the 'JsonApi' interface.