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 :
Topic | Usage |
sn/ccc/clientID/telemetry | Send device json messages to Pilot Things (MQTT publish) |
sn/ccc/clientID/action | Send Pilot Things to device json messages (MQTT subscribe) |
ccc is your company name
the clientID is the unique Thing's ID registered in Pilot Things.
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;
}
MQTT 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}
Comments
0 comments
Please sign in to leave a comment.