How to create an MQTT Gateway?

How to create an MQTT Gateway?

The MQTT gateway will allow you to get data coming from a Box/Hub direclty in your MQTT broker.



MQTT Gateway configuration:

REQUIREMENTS TO CONNECT YOUR BOX TO YOUR MQTT BROKER : You'll need your MQTT broker connection information
  1. Broker Address
  2. MQTT Port (1883,8883,etc..)
  3. Client ID
  4. Authentication information (if required)
  5. Certificate (if required)
These informations should be available in your Broker configuration, if not please contact your Broker provider.
First of all, you'll need to create a new MQTT gateway:



Fill the required Fields with your MQTT broker parameters.



TOPIC DEFINITION:

Uplink topic and Downlink topic are simple strings conformed to one or more topic levels. For instance, topics are case-sensitive.
Each topic is structured with forward slash as delimiters. The forward slash alone is a valid topic.
The broker uses the topics to filter the messages for each client subscribed to the topic

AUTHENTICATION:

If your MQTT broker require an authentication with Username and Password click on the Authentication button and fill the fields.



TLS CERTIFICATE:

IMPORTANT INFORMATION ABOUT SECURITY IN MQTT SSL/TLS:
The default port for MQTT TLS connection is : 8883
This implies a connection using certificates.
Certificates are security files that allows you to authenticate to your broker.
If you are using a TLS secured authentication please be sure that you have loaded your CA certificate.

TIPS

It can happen that your broker is not using custom CA certificate but Public one.
In that case, you will still have to load them in the Box. Because we do not stored them by default. 

Knowing that, you can now click on the TLS box if you need to specify any kind of certificates.


ADVANCED TAB:

In this advanced tab, the most important field is the Slug name
A Slug is the field that will be identify a property when you will receive it in your broker.
Here is the data format you will received:
Here is the format your broker MQTT will received:
Uplink Topic Format:
[{"propertyId":"Slug Name","timestamp":1608652394220.0,"value":12},{"propertyId":"Slug Name","timestamp":1608652394222.0,"value":123456}]
Here is format that your broker MQTT has to respect to send a command:
Downlink Topic Format:
{"propertyId":"Slug Name","requestType":"write","value":XX}


It will define what will be the value of the PropertyId field of each of your futur gateway properties.
By default it will be Protocol and Property Slug
EX:
If we have a Lorawan sensor with a temperature property, the Slug would be:
"PropertyID" : "Lorawan-MyUniqueSlug1234"


NB: Property Slug is the uniqueID of a variable, you'll find it in the property configuration itself
Please note that your modifications will be aplied for ALL properties in the Gateway.

MQTT Gateway property configuration:


To add properties to your gateway, select the properties button:



Then add Property:



On the next view you'll have the choice between all the properties available, select the one you want to redirect to your MQTT broker and click on save



Once the properties select, you'll have that kind of view:



NB : Be sure that the Access Type stay as LOCAL in this configuration.

If you need any additionnal information, please contact us at : support@wattsense.com

    • Related Articles

    • How to configure my Bacnet gateway?

      Here you will have a video that will show you how to create your bacnet gateway:
    • How to configure my ModbusIP gateway?

      Purpose of the Modbus IP Gateway: The Modbus IP gateway is designed to act as a Server in a Modbus IP network. Schematic: Step 1: First of all, you'll need to create a new gateway Step 2: Then set up the gateway information, Important information: ...
    • MQTT and QOS

      QoS stands for : Quality of service There are 3 different QoS available for MQTT: QoS level 0 : “At most once” - The message is send without acknowledgement QoS level 1 : “At least once” - The message is send with acknowledgement QoS level 2: ...