mqtt

Installation
SKILL.md

mqtt

Purpose

This skill allows the AI to interact with MQTT, a lightweight pub/sub protocol, for efficient IoT communication. Use it to publish telemetry data or subscribe to device updates, enabling real-time interactions in constrained environments.

When to Use

Use this skill for scenarios requiring low-bandwidth, real-time messaging, such as sending sensor data from IoT devices, remote device control, or telemetry monitoring. Avoid it for high-throughput needs like file transfers, where HTTP is more suitable.

Key Capabilities

  • Publish messages to topics with configurable Quality of Service (QoS) levels (0, 1, or 2).
  • Subscribe to topics and handle incoming messages asynchronously.
  • Support for retained messages, last will and testament, and wildcard subscriptions (e.g., "#" for all subtopics).
  • Secure connections via TLS and authentication methods like username/password.

Usage Patterns

To use MQTT, first connect to a broker using a client library. Establish a connection with credentials, then publish or subscribe. For example, in a loop: connect, subscribe, process messages, and disconnect. Use environment variables for sensitive data, like $MQTT_BROKER_URL for the broker address. Always handle reconnections for unstable networks.

Common Commands/API

Use the Paho MQTT library for Python interactions. Import it as follows:

Related skills
Installs
25
GitHub Stars
5
First Seen
Mar 7, 2026