Skip to main content
Version: TAO v2.x

MQTT Usage

This page explains how you can access your MQTT server, retrieve uplink packets and send downlink packets. The last section of this page describes how to change the password of the built-in MQTT broker.

  • Default topic is /uplink-topic

  • On the MQTT server, you can subscribe to the "/uplink-topic" topic, and verify that you get your packets:

    • Example on the local MQTT broker :
     mosquitto_sub -t /uplink-topic  -h <box ip> -u tao -P tao
    {"DevEUI_uplink":{"Time":"2022-03-01T16:02:56.438+00:00","DevEUI":"20635F0106000324","FPort":17,"FCntUp":14,"ADRbit":1,"MType":2,"FCntDn":2,"payload_hex":"09a0708e0000","mic_hex":"82d06336","Lrcid":"0000000F","LrrRSSI":-93,"LrrSNR":8.75,"LrrESP":-93.543648,"SpFact":7,"SubBand":"G2","Channel":"LC5","DevLrrCnt":1,"Lrrid":"FFFFFFFF","Late":0,"LrrLAT":0,"LrrLON":0,"Lrrs":{"Lrr":[{"Lrrid":"FFFFFFFF","Chain":0,"LrrRSSI":-93,"LrrSNR":8.75,"LrrESP":-93.543648}]},"CustomerID":"tao","ModelCfg":"0","DriverCfg":{"mod":{"pId":"abeeway","mId":"micro-tracker","ver":"3"},"app":{"pId":"abeeway","mId":"asset-tracker","ver":"2"}},"InstantPER":0,"MeanPER":0,"DevAddr":"03AD689F","TxPower":16,"NbTrans":1,"Frequency":867.3,"DynamicClass":"A"},"payload":{"messageType":"SHUTDOWN","trackingMode":"OFF","batteryVoltage":3.41,"ackToken":0,"periodicPosition":false,"temperatureMeasure":27.8,"sosFlag":0,"appState":0,"dynamicMotionState":"STATIC","onDemand":false,"shutdownCause":"USER_ACTION","payload":"09a0708e0000","deviceConfiguration":{"mode":"OFF"}}}
    ...
  • Default topics are /downlink-topic and /downlink-status-topic
  • The different downlink delivery failure causes are described here (search for DeliveryFailedCause in the DevEUI_downlink_Sent report).
  • You can send downlink raw encoded packets using the "downlink-topic" topic (using payload_hex).

    • Example on the local MQTT broker :
     mosquitto_pub -h <box ip> -u tao -P tao -t "/downlink-topic" -m  '{"DevEUI_downlink":{"DevEUI":"20635F0106000324","FPort":"2","payload_hex": "0102"}}'
  • Then subscribe to the "downlink-status-topic" topic to retrieve the status.

    • Example on the local MQTT broker :
     mosquitto_sub -t /downlink-status-topic  -h <box ip> -u tao -P tao
    {"response":"queued","payload":{"DevEUI_downlink":{"DevEUI":"20635F0106000324","FPort":"2","payload_hex":"0102"}}}
  • Instead of sending raw encoded payloads, you may send decoded downlink packets using the "downlink-topic" topic (using payload) and rely on the ThingPark Enterprise All-in-One encoding functions. This option is only available for branded devices having built-in payload drivers.

    • Example on the local MQTT broker :
     mosquitto_pub -h <box ip> -u tao -P tao -t "/downlink-topic" -m  '{"DevEUI_downlink":{"DevEUI":"20635F0106000324","FPort":"2","payload":{"downMessageType":"REQUEST_CONFIG","ackToken":1},"Confirmed":"1","FlushDownlinkQueue":"1","DriverCfg":{"app":{"pId":"abeeway","mId":"asset-tracker","ver":"2"}}}}'
  • Then subscribe to the "downlink-status-topic" topic to retrieve the status.

    • Example on the local MQTT broker :
     mosquitto_sub -t /downlink-status-topic  -h <box ip> -u tao -P tao 
    {"response":"queued","payload":{"DevEUI_downlink":{"DevEUI":"20635F0106000324","FPort":"2","payload":{"downMessageType":"REQUEST_CONFIG","ackToken":1},"Confirmed":"1","FlushDownlinkQueue":"1","DriverCfg":{"app":{"pId":"abeeway","mId":"asset-tracker","ver":"2"}}}}}

Changing the MQTT broker password

The built-in MQTT broker is accessible through the user 'tao'. The default password is 'tao', you may change it using a CLI command or using the 'settings' node:

  • Double click the node to open the configuration panel, only the local MQTT Password is configurable for now.

  • Change the "Local MQTT Password" and click Done.

  • Deploy the configuration like when you update a normal flow.

  • Activate the password change, click on the "settings" node:

  • Your password is now changed and all your local MQTT connections get disconnected: you have to reconfigure your 'MQTT in' and 'MQTT out' nodes to use the new password.