MQTT (Message Queuing Telemetry Transport) is the backbone of countless local smart home setups. It is a lightweight messaging protocol that lets smart home devices communicate directly with Home Assistant without routing through any cloud service.
What Is MQTT and Why Does It Matter?
MQTT works on a publish/subscribe model. Devices publish messages to topics (like home/sensors/temperature), and subscribers like Home Assistant receive those messages instantly. A broker sits in the middle, routing messages between publishers and subscribers.
For local smart homes, MQTT enables Zigbee2MQTT (Zigbee devices exposed to Home Assistant via MQTT), Tasmota (Wi-Fi smart plugs and switches), ESPHome sensors using MQTT, and any device with MQTT support.
Step 1: Install Mosquitto MQTT Broker
- Go to Settings → Add-ons → Add-on Store
- Search for “Mosquitto broker” and install it
- Start the add-on
- Go to Settings → Integrations → Add Integration → MQTT
- Home Assistant will auto-detect the local Mosquitto broker — click Configure
Step 2: Create an MQTT User
Secure your MQTT broker with authentication. In Home Assistant, create a user called “mqtt_user” and set a strong password. All devices connecting to your MQTT broker will use these credentials.
Step 3: Install Zigbee2MQTT (Optional but Recommended)
Add the Zigbee2MQTT add-on repository: https://github.com/zigbee2mqtt/hassio-zigbee2mqtt. Install and configure Zigbee2MQTT, pointing it to your Zigbee USB coordinator. Zigbee2MQTT auto-discovers Home Assistant via MQTT autodiscovery.
Step 4: Connect Tasmota Devices
If you have smart plugs or switches running Tasmota firmware, in the Tasmota web interface go to Configuration → Configure MQTT, set Host to your Home Assistant IP address, set Username and Password to your MQTT user credentials. Enable autodiscovery in the Tasmota console: SetOption19 1. The device will appear automatically in Home Assistant within seconds.
Useful MQTT Debugging Tools
MQTT Explorer (free desktop app) lets you subscribe to all MQTT topics and see messages in real time. Invaluable for troubleshooting. In Home Assistant itself, the MQTT integration has a built-in “Listen to a topic” tool in the integration settings.
Security Best Practices
- Always use authentication (username and password) — never run an open MQTT broker
- Keep the MQTT broker on your local network — do not expose port 1883 to the internet
- For remote MQTT access, tunnel it through Tailscale rather than port forwarding
- Use unique topics per device to avoid message collisions