We are here to help

Protocole MQTT

Introduction

MQTT is a messaging protocol largely used with IoT devices or gateways. More information on MQTT are available here : https://mqtt.org/

MQTT connexion and topics

Pilot Things implements a secured MQTT connexion using SSL/TLS. You will get the connexion informations from Pilot Things.

Pilot Things implements specific topics to communicate :

  • publish to sn/companyName/ClientID/telemetry to send JSON messages to Pilot Things
  • publish to sn/companyName/ClientID/message to send RAW messages
  • subsrible to sn/companyName/ClientID/action to receive command/messages from Pilot Things

Remember MQTT topics are case sensitive.

MQTT generic product

You must associate your things with a product for Pilot Things to recognize it.

When using the MQTT generic product model, the JSON received payload is store in a specific measurement named message.

For instance, suppose you publish to /telemetry this JSON value : {"temperature": 10,  "humidity": 10} then you will get a message measure set to {"temperature": 10,  "humidity": 10}.

If you want to convert this message to custom measurements, create a custom model with your measurements name and this code :

function createCustomMeasure(thing, measurements, previousMeasurements, previousCustomMeasurements) {return measurements;}

Example

Step1 : Get your thing's ID in Pilot Things console. You can find the id in the thing's detail page URL.

Id = 7b74389c-8cda-11eb-8dcd-0242ac130003

Step2: Get your certificate and private key from Pilot Things support team

Step3: Send a test message to your thing (replace company with your company name)

MQTT publish to sn/company/7b74389c-8cda-11eb-8dcd-0242ac130003/telemetry

JSON MQTT message : {"temperature": 10,  "humidity": 10}