GitPedia

Aiomqtt

The idiomatic asyncio MQTT client

From empicano·Updated June 22, 2026·View on GitHub·

> [!NOTE] > aiomqtt v3 is released! It switches the underlying protocol library from paho-mqtt to the sans-io [mqtt5](https://github.com/empicano/mqtt5) library. This means aiomqtt is now pure asyncio (no more threads). Try it with `pip install aiomqtt==3.0.0-alpha.1`. The project is written primarily in Python, distributed under the BSD 3-Clause "New" or "Revised" License license, first published in 2020. Key topics include: async, asyncio, client, internet-of-things, iot.

Latest release: v3.0.0-alpha.1
April 2, 2026View Changelog →

[!NOTE]
aiomqtt v3 is released! It switches the underlying protocol library from paho-mqtt to the sans-io mqtt5 library. This means aiomqtt is now pure asyncio (no more threads). Try it with pip install aiomqtt==3.0.0-alpha.1.

aiomqtt

<a href="https://pypi.org/project/aiomqtt"><img alt="PyPI downloads" src="https://img.shields.io/pypi/dm/aiomqtt"></a> <a href="https://pypi.org/project/aiomqtt"><img alt="PyPI version" src="https://img.shields.io/pypi/v/aiomqtt"></a> <a href="https://pypi.org/project/aiomqtt"><img alt="Supported Python versions" src="https://img.shields.io/pypi/pyversions/aiomqtt.svg"></a>

The idiomatic asyncio MQTT client. Write code like this:

Publish

python
async with aiomqtt.Client(hostname="test.mosquitto.org") as client: await client.publish("ducks/louie/status", b"quack")

Subscribe

python
async with aiomqtt.Client(hostname="test.mosquitto.org") as client: await client.subscribe( aiomqtt.TopicFilter("ducks/#"), max_qos=aiomqtt.QoS.AT_MOST_ONCE, ) async for message in client.messages(): print(message.payload)

Key features

  • No callbacks! 👍
  • Complete MQTTv5 support (backpressure, user properties, ...)
  • Automatic reconnection
  • Fine-grained control over acknowledgments
  • Pure asyncio
  • Fully type-hinted

Installation

pip install aiomqtt

The only dependency is mqtt5.

Documentation

To get started, see the guides.

If you're new to MQTT, we recommend reading HiveMQ's MQTT essentials as an introduction. Afterward, the MQTTv5 specification is a great reference.

The RealPython walkthrough is a nice introduction to Python's asyncio.

Contributing

We're happy about contributions! See CONTRIBUTING.md to get started.

Versioning

This project adheres to Semantic Versioning.

Changelog

See CHANGELOG.md, which follows the principles of Keep a Changelog.

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from empicano/aiomqtt via the GitHub API.Last fetched: 6/29/2026