Tutorial: Subscribe to and publish MQTT topics


Basic architecture

The MQTT plugin provides many features that is not exist in any MQTT client beside the extra features that will be provided from the BMS Platform itself.

  • Subscribe to the Broker or many Brokers simultaneously.
  • Get the Published messages from different topic.
  • Publish messages from BMS Server other fieldbus technologies (KNX, . . ) through MQTT broker to other subscribed Clients.
  • Add those info to the Server

MQTT Plugin will allow the BMS Server to act like Mqtt Client. BMS Server will be able to connect not only to one Mqtt Server at one time, but also will be able to many Mqtt Server simultaneously. And subscribe to different Topic from those Servers at the same time.

Integration steps

After installing the plugin, a new Menu under Modules will be added. This menu is corresponding with the configuration of the MQTT Plugin in the BMS Platform

Adding a broker

Adding a Broker in BMS Platform by choosing Broker menu. Broker Definitions tab will show up.
Definitions table allows to add as many Brokers as wanted.
Mqtt Broker handle two types of Brokers:

  • Secure Broker (TLS)
  • Non-Secure Broker

Secure Broker: TLS and SSL are cryptographic Protocols which provide a handshake mechanism to arrange different parameters to make a safe connection between the Client and the Server.
MQTT depends on TCP transport protocol, which implies the connection does not use an encryption. To encrypt the MQTT communication, MQTT brokers like Mosquitto permit to use TLS rather than plain TCP. Adding username and password fields of the MQTT Broker definition for authentication and authorization.
Port 8883 is for a secured MQTT connection, but this can be changed based on Broker configuration File.

In BMS Server adding a Secure Broker can be easily done.

More information about the different configuration options can be found here.

Certificate: The Certificate should be saved in DataFile Folder in the current Workspace, and it is enough to provide only the name of the certificate without the full path.

Non-Secure Broker

Non-secure Broker supports only a TCP plain connection between Client and the Broker. To configure a non-secure Broker in BMS Platform the IP Address and the Port usually 1883 is used.

After configuring the Broker, changes must be saved and the BMS Core needs to be restarted.

Adding a Datapoint

In Broker definitions we added the connection configuration. But those Brokers should be represented in the BMS Core, and this Connections representation in BMS Core done by creating a Datapoint or many Datapoints for each of the Brokers. This Datapoint will make this Broker interactive and reachable in BMS Core. This Reachability will also allow other Datapoints form other Automation System like KNX or BACnet to interact with this Broker.

More information about the different configuration options can be found here.


Related pages