/
Subscribing and Publishing MQTT Messages from Gateway(Semtech Packet Forwarder Protocol)


Copyright Micropelt

Subscribing and Publishing MQTT Messages from Gateway(Semtech Packet Forwarder Protocol)

Links to Documentation

Description

Link

Description

Link

MQTT Message Structure and Documentation

(For Multitech Gateways)

MQTT Messages

Subscribing to MQTT Messages from the device

  • MQTT Command to view UPLINK Messages

  • mosquitto_sub -v -t lora/<enter-DEV-EUI-here>/up -u <Enter_Username_if_any> -P <Enter_Password_if_any>

  • Example

  • mosquitto_sub -v -t lora/30-37-37-35-60-31-5f-0f/up -u User -P top_secret_password
  • Response

  • lora/30-37-37-35-60-31-5f-0f/up { "tmst":1670771435, "chan":0, "rfch":0, "freq":868.1, "stat":1, "modu":"LORA", "datr":"SF7BW125", "codr":"4/5", "lsnr":10.2, "rssi":-27, "opts":"", "size":11, "fcnt":8, "cls":0, "port":1, "mhdr":"40d1c4fd00000800", "data":"ADk/c3MAfy4AEiY=", "appeui":"31-20-03-21-ec-61-07-00", "deveui":"30-37-37-35-60-31-5f-0f", "devaddr":"00fdc4d1", "ack":false, "adr":false, "gweui":"00-80-00-00-00-01-8c-8a", "seqn":8, "time":"2023-06-09T11:56:16.293904Z" }
  • The "data" field contains the uplink data in Base64 format.

    • "data" : "ADk/c3MAfy4AEiY="

  • Paste the Base64 Payload into the Excel Tool MLR003 Payload Encoder/Decoder

  • (Uplink Decoder Sheet) and Click Convert to view the decoded messages

  • The Excel decoder output will be as follows

Publishing MQTT Messages to the Device

  • MQTT Command to send Downlink messages to the device

  • mosquitto_pub -t lora/<enter_DEV_EUI_here>/down -m '{"data":<enter_Base64_payload_here>,"port":1}' -u <enter_Username> -P <enter_Password>

  • Use the Excel Tool to prepare the Base64 Payload for the Downlink from “Downlink Encoder“ Tab MLR003 Payload Encoder/Decoder

  • Example Downlink Payload

  • SQAoAABA
  • Example

  • mosquitto_pub -t lora/30-37-37-35-60-31-5f-0f/down -m '{"data":"SQAoAABA","port":1}' -u User -P top_secret_password

 

Related content