Beginners python library for MQTT

0

I previously looked around and didnt find any pre-existing SIMPLE library for my need, to use MQTT directly through IoT core instead of greengrass.

So I wrote one myself: https://github.com/ppbrown/aws-iot-mqttlib

Its a bit rough around the edges. But it does make it waaay easier to now write nice, short, concise code:

    mqtt_connection = create_iot_connection()
    mqtt_connection.publish(
        topic=TESTTOPIC ,
        payload=message,
        qos=mqtt.QoS.AT_LEAST_ONCE)

so now you dont need 100 lines of boilerplate code in every python code file that needs to talk MQTT directly.

Does anyone know of a better, COMPACT library already existing that is out there?

I do notice that there exists the page: https://repost.aws/knowledge-center/iot-core-publish-mqtt-messages-python

but it isnt in existing separate code form, and it doesnt have the extra auto-reconnect calls that I have in my lib

asked 10 months ago346 views
1 Answer
0

Hello,

It's great to see that you've created a library to simplify the process of using MQTT with AWS IoT Core in Python. Your library seems to provide a neat and concise way to establish a connection and publish messages, which can be very useful for many developers.

As for your question about existing libraries, there are a few options, but they might not be as compact or as focused on your specific use case as your library. Here are a few:

  1. AWS IoT Device SDK for Python: This is the official AWS SDK for IoT devices. It provides a broad set of features for connecting and interacting with AWS IoT Core, but it might be more complex than what you're looking for.
  2. Paho MQTT Python Client: This is a popular general-purpose MQTT client for Python. It's not specific to AWS IoT Core, so it doesn't handle AWS-specific features like authentication out of the box, but it's a well-maintained and widely used library.
  3. AWS IoT SDK for Python v2: This is a newer version of the AWS IoT Device SDK for Python. It's built on the AWS Common Runtime, a set of libraries for building AWS SDKs. It provides a lot of features, but again, it might be more complex than what you're looking for.

Hope these are useful!

profile picture
Zac Dan
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions