
MQTT — IoT Messaging Protocol
The publish-subscribe messaging backbone of modern IoT. How MQTT fits into smart home and building automation alongside KNX, DALI, and Home Assistant.
What is MQTT?
MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe messaging protocol originally designed for satellite links in the 1990s (IBM/Eurotech). Today it's the dominant protocol for IoT device-to-server communication — from ESP8266 sensors to industrial PLCs.
Unlike KNX (bus-based) or Modbus (master/slave), MQTT uses a broker model: devices publish messages to topics on a central broker (e.g. Mosquitto), and any subscriber listening to that topic receives the message. No direct device-to-device communication.
Core concepts:
- Broker: Central server that routes all messages (Mosquitto, HiveMQ, EMQX). In smart home = runs on HA server or separate Pi.
- Topic: Hierarchical string path, e.g.
home/livingroom/light/state - Publish: A device sends a message to a topic
- Subscribe: A client listens to a topic and receives all messages published to it
- Retained message: Broker stores last value — new subscribers get it immediately
- QoS 0/1/2: At most once / At least once / Exactly once delivery guarantee
MQTT specification
| Parameter | Value |
|---|---|
| Standard | ISO/IEC 20922 (MQTT 3.1.1), MQTT 5.0 |
| Transport | TCP/IP (port 1883) or TLS (port 8883) |
| Topology | Star (broker-centric) |
| Direction | Bidirectional publish/subscribe |
| Payload | Any binary/text — typically JSON or plain value |
| Topic separator | / (forward slash), e.g. home/floor1/room2/temp |
| Wildcard (single level) | + (plus), e.g. home/+/light |
| Wildcard (multi-level) | # (hash), e.g. home/# |
| QoS 0 | Fire and forget — no delivery guarantee |
| QoS 1 | At least once — receiver ACKs (may duplicate) |
| QoS 2 | Exactly once — 4-way handshake |
| Retained messages | Broker stores last message per topic |
| Will message | Sent by broker if client disconnects unexpectedly |
| Authentication | Username/password, TLS certificates |
| Port (unencrypted) | 1883 |
| Port (TLS) | 8883 |
MQTT in smart home — the ecosystem
MQTT is the common language of DIY and semi-professional smart home. Several large projects use it as their transport layer:
Zigbee2MQTT
zigbee2mqtt.ioTranslates Zigbee radio telegrams to MQTT. Connect a Zigbee coordinator (CC2530, SkyConnect) to HA, run Zigbee2MQTT, and 2,500+ Zigbee devices appear as MQTT topics. No Philips Hue hub needed.
Tasmota / ESPHome
tasmota.github.ioOpen-source firmware for ESP8266/ESP32 modules. Flash a cheap Sonoff relay with Tasmota and it becomes an MQTT-publishing smart switch. ESPHome is HA-native.
Home Assistant MQTT integration
home-assistant.ioHA can publish and subscribe to any MQTT topic. Configure via YAML or UI. MQTT Discovery auto-creates HA entities when a device announces itself via a specific topic.
Node-RED
nodered.orgFlow-based visual programming that subscribes to MQTT topics, applies logic, and publishes to other topics or KNX/HTTP endpoints. Often used alongside HA for complex routing.
WirenBoard
wirenboard.comRussian DIN-rail controller uses MQTT as its primary protocol. WirenBoard publishes all sensor readings and accepts control via MQTT topics. Works with HA and Node-RED.
Topic structure examples
Example MQTT topic tree (smart home)
home/
├── livingroom/
│ ├── light/state → "ON" / "OFF"
│ ├── light/brightness → "75" (0-100%)
│ ├── light/color_temp_k → "3000"
│ ├── temperature → "21.5"
│ └── occupancy → "true" / "false"
├── kitchen/
│ ├── light/state → "ON"
│ └── humidity → "45"
├── bedroom/
│ ├── blind/position → "75" (0=open, 100=closed)
│ └── thermostat/setpoint → "20.5"
└── panel/
├── meter/power_w → "1247"
└── meter/energy_kwh → "1852.3"MQTT vs KNX — when to use which
| Aspect | MQTT | KNX TP |
|---|---|---|
| Infrastructure | IP network (Ethernet/WiFi) | Dedicated TP bus cable |
| Reliability | Depends on network + broker uptime | Deterministic, bus is always on |
| Latency | Milliseconds (IP) + broker roundtrip | <50ms (direct bus telegram) |
| Scalability | Unlimited (horizontal scaling) | 255 addresses per line, 15 lines max |
| Setup complexity | Low (broker + publish/subscribe) | High (ETS programming, addressing) |
| Hardware cost | Low (ESP8266 = €2) | High (KNX actuator = €50–200+) |
| Certification | None required | KNX certified + ETS license |
| Works without server | ❌ Broker must be running | ✅ Local bus works without server |
| Best use case | Sensor data, IoT integration, flexible DIY | Safety-critical control, commercial building |
| Typical user | Maker, HA integrator, IoT developer | Electrical engineer, DALI/KNX specialist |
The real answer: In a well-designed premium installation, KNX handles hardware control (switching, dimming, shutter) and MQTT/IP handles sensor data aggregation and software integrations (energy monitoring, presence, weather). They're complementary — not competing.
KNX + MQTT integration options
Home Assistant (KNX + MQTT integrations)
Both KNX and MQTT integrations run in HA. Automations can read MQTT sensor values and trigger KNX actuators — or vice versa. Zero additional hardware.
knx-mqtt-bridge (open source)
Standalone Node.js service that bridges KNX group addresses to MQTT topics bidirectionally. Each KNX GA maps to an MQTT topic. Runs on Pi or Docker.
Node-RED KNX + MQTT nodes
node-red-contrib-knx + MQTT nodes. Visual flow programming: MQTT topic → transform → KNX telegram. Good for complex conditional routing.
WirenBoard WB-MGW gateway
WirenBoard gateway unit can translate between RS-485/Modbus devices and MQTT. Then HA reads MQTT and publishes to KNX. Common in Eastern EU.
KNX + MQTT architecture designed for your project
We integrate MQTT sensor networks with KNX control panels — Zigbee2MQTT, energy meters, HVAC sensors — all unified in one system.
Request a quote →