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

client.subscribe(device_id, 0)

Publish

An example of publishing data.

Subscribe

An example of subscribing to a topic and receiving the message.

Log

Disconnect

✨ Support and Feedback

If you have further questions or suggestions, feel free to join πŸ‘‡ -> Qubitro Community Discord via this invitation link.

Last updated