Links

Python

Quick guide for Pyhton library.

Getting Started

Visit the MQTT overview page for conventions, authentication, and more information.
This documentation uses the Paho MQTT library. This library is open-source, so that you can check it out on GitHub.

Install the packages

pip3 install paho-mqtt
Then import it and initialize it with the required packages. Of course, you’ll want to replace DEVICE_ID and DEVICE_TOKENwith your actual device credentials which you can find under your device settings on Qubitro Portal.
import paho.mqtt.client as mqtt
import json
import ssl

Examples

We strongly recommend using the 8883 port for MQTT over TLS connectivity.

QoS Options

QoS 0
QoS 1
QoS 2
client.subscribe(device_id, 0)
client.subscribe(device_id, 1)
client.subscribe(device_id, 2)

Publish

An example of publishing data.
Qubitro MQTT Publish Example

Subscribe

An example of subscribing to a topic and receiving the message.
Qubitro MQTT Subscribe Example

Log

Qubitro MQTT Log Example

Disconnect

Qubitro MQTT Disconnect Example

​
✨
Support and Feedback

If you have further questions or suggestions, feel free to join
👇
-> Qubitro Community Discord via this invitation link.
Last modified 2mo ago