MQTT

Characteristics - MQTT

MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT). To learn more about the standard visit the MQTT website.

Information Model Requirements

  • The first Node after the root node rootNode must be of type Event eventNode.

  • The following Node Types can be used under the Event Node:

  • In case of publishing a topic, the Information Model determines the structure of the payload.

  • In case of subscribing to a topic make sure that the Information Model structure matches the payload.

Configuration - MQTT Channel

  1. Select the MQTT (JSON) as Channel Type.

  2. Click the Configure button.

MqttConfiguration
  1. Select the root model node

  2. Configure the MQTT To String configuration:

    • Enter Host and Port of the MQTT Broker used

    • If required, adjust the default values for Reconnect interval, Connection timeout, Keep alive interval and the Unit for each

    • Specify a path to a folder on your local machine. The temp directory inside the SMARTUNIFIER Manager can be used as well.

    • (Optional) Specify a Client ID

    • Set the Quality of Service (QoS)

    • (Optional) Enable Retained if required

    • Select Username and password in order to manually enter the credentials or select Username and password credentials reference to add it from the Credentials Manager. If there are no credentials needed (e.g., test.mosquitto.org) select None.

MqttModelRootNodeConfiguration MqttModelRootNodeConfiguration
  1. Select the event node in the tree on the left.

  2. Enable either Producer or Consumer depending on the use case and enter a Topic name.

  3. Click the Apply button.

MqttModelEventNodeConfiguration

The Producer or Consumer option can be enabled for a Variable node.

MqttModelVariableNodeConfiguration

Json To Model Event Configuration

This configuration is used when some keywords or reserved words can’t be used in the Information Model.

  1. Select the event node in the tree on the left.

  2. Check the box for the Events configuration.

  3. Input the Field name, representing the reserved word.

  4. Click on the Apply button.

MqttModelEventsConfiguration

Json To Model Variable Configuration

  1. Select a variable in the tree on the left.

  2. Check the box for the Variable configuration.

  3. Input the Field name, representing the reserved word.

  4. Click on the Apply button.

MqttModelVariableConfiguration

Certificates

Encrypted connection using TLS security is supported. Follow the steps below to encrypt the connection.

  1. Enable Hostname Verification (optional)

  2. Enable the Tls Configuration checkbox

  • Enter the path to the CA (certificate authority) certificate of the CA that has signed the server certificate

Note

Make sure the CA certificate is valid.

  1. Enable the Client checkbox

  • Enter the path to the Client certificate. The client certificate identifies the client just like the server certificate identifies the server.

  • Enter the path to the Private client key.

  • If applicable select to enter a Password or to add from the Credentials Manager.

  • Select the Protocol from the Drop-Down.

Mqtt Configuration Certificates

Disconnected Buffer

In case the connection is lost, messages can be buffered offline when the Disconnected Buffer is enabled. Follow the steps below to enable the DisconnectedBuffer.

  1. Enable the Disconnected Buffer checkbox.

  2. Set the Buffer size - defines the number of messages being hold e.g., 5000.

  3. (Optional) Enable Persist Buffer.

  4. (Optional) Enable Delete Oldest Message.

MqttConfigurationDisconnectedBuffer

Description of configuration properties:

Property

Description

Example

host

URL of the MQTT Broker.

test.mosquitto.org

port

Port of the MQTT Broker.

1883

reconnectInterval

Time interval to reconnect to the MQTT Broker after loss of connection in seconds

5

connectionTimeout

Time interval the connection times out in seconds

60

keepAliveInterval

Time the session persists in seconds

60

persistenceFolder

Path to a folder for the persistence store of the MQTT

temp

clientId

Identifies an MQTT client which connects to an MQTT Broker

MyClientID

username

Client username

Username

password

Client password

Password

hostnameVerification

Hostname Verification

true, false

tls

Encryption

true, false

producers

Data producer

true, false

consumer

Data consumer

true, false

protocol

TLS protocol version

TLSv1.1, TLSv1.2

disconnectedBuffer

Offline buffering of data

true, false

bufferSize

Amount of message allowed in the buffer

5000

persistBuffer

Buffer persistence

true, false

deleteOldestMessage

Delete oldest message in buffer

true, false