MQTT Tutorials


Basic architecture

Mqtt Plugin provides many features that is not exist in any Mqtt Client beside the extra features that will be provided from the BMS Server 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 Server


Adding a Broker:

Adding a Broker in BMS Server 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.


ParameterDescription

Name

The given name of the Broker in BMS Server

Path

The generated Path in Item Tree

IP address

The IP address of the Broker

Auto-Reconnect

The Reconnect time interval for the BMS Server to try to connect to the Broker if the Connection lost.

Port

Port number

Client username

If the Broker requires Authentication with a Username and a Password.

Client Password

If the Broker requires Authentication with a Username and a Password.

TLS[]

Enable/Disable TLS Connection to the Server

TLS Version

Support many versions of TLS Connections.

*CA -Cer[]

Certificate name

CA-Password

Password for Certificate for self-signed Certificates.

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 Server the IP Address and the Port usually 1883 is used.

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

Adding a Datapoint: 

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

Parameter

Description

Name

Should be the same as defined Broker Name in Broker definitions

Path

Should be the same as defined Broker Path in Broker definitions

Topic

The topic of subscription

Data type

Data type of the Value BMS has two data types: REAL or String

Port

Port number

Access mode

Read, Read and Write or Write.

Persistent

This parameter specifies whether the value of the datapoint is persistent (restored from the database after server start up) or not.

Historical

This parameter specifies whether historical values of the datapoint are stored within the database or not.

Synchronize

If this parameter is set to “True (T)”, the value is synchronized between the main and backup server (if present).