MQTT
Lightweight publish/subscribe messaging protocol designed for IoT and machine-to-machine communication. An OASIS standard used by 56% of industrial IoT projects.

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol based on the publish/subscribe model, designed for machine-to-machine (M2M) communication and the Internet of Things. Standardized by OASIS and ISO (ISO/IEC 20922), it is used by 56% of industrial IoT projects for its lightness, reliability and low bandwidth consumption.
Technical definition
Publish/subscribe architecture
MQTT revolves around three components: publishers (message senders), subscribers (receivers) and the broker (the central routing server). A publisher sends a message to a topic (a hierarchical path, e.g. zigbee2mqtt/chambre_thermostat/set), and the broker redistributes it to every client subscribed to that topic.
This decoupling is fundamental: the publisher does not know the subscribers, and vice versa. It enables an extensible architecture where adding a new consumer requires no change to the producer. Topics support wildcards: + (one level) and # (all sublevels).
Lightness and performance
The minimum overhead of an MQTT packet is 2 bytes (1 byte for type + flags, 1 byte for remaining length), versus several hundred for HTTP. The TCP connection stays open with a configurable keep-alive mechanism, allowing latencies on the order of a millisecond. The protocol supports retained messages (the last state kept by the broker for new subscribers) and Last Will and Testament (an automatic message sent when a client disconnects abruptly).
QoS and reliability
Three Quality of Service levels: QoS 0 (fire-and-forget), QoS 1 (at least once, with a PUBACK acknowledgment), QoS 2 (exactly once, 4-step handshake). The choice of QoS depends on the latency/reliability trade-off the application requires.
This interactive diagram needs JavaScript.
Applications in home automation
MQTT in Home Assistant
In a typical Home Assistant setup, the Mosquitto broker runs locally and serves as the communication hub. Zigbee2MQTT converts Zigbee messages into structured MQTT topics. Home Assistant subscribes to these topics through the MQTT integration and automatically exposes the entities (sensors, thermostats, switches).
A concrete example: when a Bosch BTH-RM thermostat changes its setpoint, Zigbee2MQTT publishes a JSON payload to zigbee2mqtt/chambre_thermostat containing occupied_heating_setpoint, local_temperature, humidity, and so on. Home Assistant receives the message and updates the corresponding climate entity in real time.
MQTT in industry
Beyond home automation, MQTT is massively deployed in industrial IoT (IIoT): machine monitoring (Siemens MindSphere), connected vehicles, smart energy grids and precision agriculture. The AWS IoT Core and Azure IoT Hub cloud platforms support MQTT natively for ingesting device data.
Standards and Specifications
MQTT v5.0 (OASIS Standard)
Current version of the MQTT protocol, with session properties, richer reason codes and shared subscriptions
MQTT v3.1.1 (ISO/IEC 20922)
The most widely deployed version, ISO-standardized, the foundation of most IoT implementations
Frequently Asked Questions
What is the difference between MQTT and HTTP for IoT?
MQTT uses a publish/subscribe model over a persistent connection, while HTTP works with stateless request/response. MQTT uses far less bandwidth: a typical message is a few dozen bytes versus several hundred for an HTTP request with its headers.
MQTT keeps a TCP connection open with keep-alive, allowing latency of a few milliseconds. HTTP requires opening a new connection for each exchange (except with HTTP/2). For battery-powered IoT sensors or constrained networks, MQTT is the de facto standard.
What is an MQTT broker?
The broker is the central server that receives every message published by clients and redistributes it to interested subscribers. The most widely used brokers are Mosquitto (open source, lightweight, ideal for Home Assistant), EMQX (high availability, clustering) and HiveMQ (enterprise, cloud-native).
In a Home Assistant setup, Mosquitto runs as a local add-on and acts as the communication hub between Zigbee2MQTT (which publishes device states) and Home Assistant (which subscribes to topics to create entities).
What are MQTT QoS levels?
MQTT defines three Quality of Service levels: QoS 0 (at most once, fire-and-forget, no delivery guarantee), QoS 1 (at least once, the message is retransmitted until acknowledged, duplicates possible) and QoS 2 (exactly once, a 4-step handshake guaranteeing a single delivery, slower).
In home automation, QoS 1 is the standard compromise: reliable without excessive overhead. Zigbee2MQTT publishes at QoS 0 by default for performance, but critical commands (changing a thermostat setpoint) benefit from QoS 1.