Skip to content

Asyncio-mqtt

Idiomatic asyncio wrapper around paho-mqtt

Simple example

Subscriber

async with Client("test.mosquitto.org") as client:
    async with client.messages() as messages:
        await client.subscribe("humidity/#")
        async for message in messages:
            print(message.payload)

Publisher

async with Client("test.mosquitto.org") as client:
    await client.publish("humidity/outside", payload=0.38)

See also

Favorite site