Send Binary Data Using MQTT

You need to create a binary rule before sending data Create Binary Rule

  • The connection to the MQTT server is as below
    • Host: v5.boodskap.io
    • Port: 1883
    • Client ID: Your Device Token
    • Username: Not required
    • Password: Not required
    • MQTT Topic /{token}/pub/bin/{type}
    • Data
      • JSON Data

๐Ÿ“˜

QOS

MQTT QOS (Quality Of Service) should be always 2

Examples

import paho.mqtt.publish as publish

clientid = "YOUR DEVICE TOKEN"

topic = "/YOUR_DEVICE_TOKEN/pub/bin/CustomJson"

payload = "{
    "sensor": "WEATHER",
    "latitude": 32.779167,
    "longitude": -96.808891,
    "temperature": 26,
    "humidity": 77,
    "precipitation": 0,
    "wind": 11
}"

publish.single(hostname="v5.boodskap.io", topic=topic, payload=payload, qos=2, client_id=clientid)

Receiving Messages

Data sent from from the platform to the device will be available at

  • Subscribe to MQTT Topic: /{key}/device/{did}/cmds
    • key -> Domain Key
    • did -> Device Unique ID

Worth Seeing