Tutorial: Subscribe to and publish MQTT topics
Basic architecture
The MQTT plugin provides many features that do 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
The MQTT plugin will allow the BMS Server to act like a MQTT client. The BMS Server is able to connect not only to one MQTT server at one time, but also to many MQTT server simultaneously. And subscribe to different topics from those servers at the same time.
Integration steps
After installing the plugin, a new menu entry 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 default 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.
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 default port 1883 is used.
Adding a Datapoint
As a next step, the datapoints need to be configured with the means on MQTT datapoint definitions to represent the MQTT topics in the item tree. These datapoints act like any other datapoints, so for example you, can map KNX or BACnet datapoints to the MQTT datapoints with Virtual Links to forward their values.
Resulting Item tree
After saving the configurations and restarting the server, the item tree contains the configured datapoints: