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.

Regards,
Stefan

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 https://www.emqx.io/.

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.

Regards,
Stefan

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

paul

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