Implementation of MQTT

There is currently a lot of work going on to use and integrate the MQTT protocol in OpenEMS.

MQTT (Message Queuing Telemetry Transport) is an open OASIS and ISO standard (ISO/IEC 20922) lightweight, publish-subscribe network protocol that transports messages between devices.
MQTT - Wikipedia

There are two major use-cases where MQTT could play a role:

  1. MQTT for communication between Edge <-> Backend <-> UI
  1. MQTT as local Edge bridge to peripherial devices

I am curious to hear your opinions about the implementations and your use-cases, so that we can consider them in this early stage of the development.


Hi Stefan,
shortly update :slight_smile:. This feature will be the first we will push. Felix is finished with his bachelor thesis and we improved the mqtt communication a bit. So that it should be really flexible and configurable for all OpenEMS-Components.
It is the next step on the roadmap.
Sry that it took so long.

Or use cases are mostly “logging” easily over a mqtt broker with usermanagement at the broker.
even “cloud” stearing over the usermanagement should be done easily.

the third part will be “scheduling” some Channels or components. for example “turning on the chp at 5 o Clock”, based on forecasts (Plan mid year)

Thanks Paul. I had been writing with Felix alread in the linked Github Issue. Things take time, that’s ok. Just wanted to give some public attention to this and possibly collect other use-cases as well.

By logging you mean: sending all channel values on every update to the broker? My implementation does this to the topic edge/{Client-ID}/channel/{Component-ID}/{Channel-ID}. (see Create binding for Eclipse SmartHome/OpenHAB · Issue #33 · OpenEMS/openems · GitHub for details).

Which MQTT broker are you using? How do you handle user-management? I am currently evaluating

For “Scheduling” I am planning to translate the existing JSON-RPC infrastructure to seemlessly support RPC via MQTT. Maybe similar to this: GitHub - rse/mqtt-json-rpc: JSON-RPC protocol over MQTT communication.


Hi Stefan, thanks. Good to know :slight_smile:

The logging procedure is a bit different.
You need to configure the channels you want to have “published” manuelly in a component.
you can use more than “one” MQTT broker. we are using “rabbit mq” . And as far as i know, you can configure the “payload” in OpenEMS. But i will check with Felix next week.

The user / rightmanagement is for that on the “Server-Side”/Broker side. and it is done over LDAP.

But all of the Cloud part is done by a different team. I ll send you the “cloud” informations asap.

RPC over MQTT :slight_smile: sounds interesting. We dont have a complete concept yet. But “scheduling” for us will be over a given “long periode” at least one minute (but propably longer. 15min ).

best regards


I have very good experience with Mosquitto. Super stable, slim footprint and runs nicely in a container.

There is now an MQTT implementation in OpenEMS. It does not yet have the features proposed in this thread, but at least it’s a start. Please see the commit notes for details.


hei Stefan,

super :). ich habs mal zum prüfen gegeben, wie wir das ggf. in unseres integrieren können.
Außerdem bauen wir das MQTT feature von uns noch um, dass es auch mit der Azure-cloud funktioniert.
Dann kann man sich ggf. für eine andere Cloud da heran/herumangeln :smiley:


This would definitely be an interesting addition to the OpenEMS platform. Could Notification generation also be considered as a use case of MQTT broker?

With notifications, I mean sending a push notification to the UI platform or sending an email to a set of defined email-Ids. This would be great, especially when we are dealing with a lot of connected devices, and the developer or maintainer wants to stay updated of states of all the devices. Or maybe when the EMS generates some suggestions as per its algorithms, and wants to inform the user about it.


Hello Laksh,

right now we connect the mqtt IoT-Hub with Grafana. there you can customize Notifications to email, Teams, Telegram :smiley: and many more.
Directly out of the broker it is architectully not possible. but there can be connected many other apps to get this functionality
best regards


1 Like

Hi everyone,
I need an additional modification for the login to our company server.
We are using the following services: OpenEMS => RabbitMQ => Telegraf => Influxdb => Grafana
But for the login to the RabbitMQ I need to integrate our companies CA certificate.
I modified the following example script to make the connection possible:

I actually got rid of the TLS part and only used the CA certificate. The implementation into OpenEMS seems to be straight forward but I don’t know how to include the libraries to OpenEMS. The bouncycaslte library seems not to be part of the osgi standard libraries…it would be great if somebody could help me with that issue.
Thank you!
All the best,

@NilsReiners: I created a pull request that adds the BouncyCastle library for CA certificates. The implementation was quite straight forward as BouncyCastle already comes with all the required MANIFEST headers. Implementation is based on the linked code and not finished (e.g. file paths are not yet configurable), but should provide a good base. Are you able to work with this?