Skip to content

Home Assistant MQTT Bridge — Complete Guide

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Home Assistant MQTT Bridge. We cover key concepts, practical examples, and best practices.

Hook

You have an MQTT broker running (Mosquitto) and devices publishing to topics. Home Assistant is subscribed to those topics, but the entities show "Unavailable." The debugger shows MQTT messages arriving at the broker, but Home Assistant does not see them.

The Wrong Way

Running multiple MQTT brokers in parallel without a bridge between them creates silos — devices on one broker are invisible to clients on another.

# BAD: Two separate MQTT brokers with no bridge
# Broker 1: mosquitto (port 1883) for sensors
# Broker 2: mosquitto (port 1884) for Home Assistant
Sensor publishes to 1883
Home Assistant subscribes to 1884
Topic never reaches HA — different brokers

Two unrelated brokers cannot share messages without a bridge.

The Right Way

Use a single broker or configure an MQTT bridge between two brokers.

# 1. Verify Home Assistant's MQTT config
cat /config/configuration.yaml | grep -A5 "mqtt:"
mqtt:
  broker: 192.168.1.50
  port: 1883
  username: hass
  password: securepassword
# 2. Check if Home Assistant can reach the broker
docker exec hass mosquitto_sub -h 192.168.1.50 -p 1883 -u hass -P securepassword -t "#" -C 1
(no output — timeout or auth error)

If the test fails, check broker authentication:

# 3. Test with telnet
echo | nc -w 2 192.168.1.50 1883
(empty — port is open but broker may need auth)
# 4. Configure Home Assistant with the correct credentials
# Web UI → Settings → Devices & Services → MQTT → Configure
# 5. Restart Mosquitto and Home Assistant
docker restart mosquitto hass
[INFO] MQTT: Connected to broker 192.168.1.50:1883
[INFO] MQTT: Subscribed to topic homeassistant/#

If you need two brokers, set up a bridge in Mosquitto:

# /etc/mosquitto/conf.d/bridge.conf
connection hass-bridge
address 192.168.1.51:1883
topic # both
remote_username hass
remote_password securepassword

Prevention

  • Use a single MQTT broker for all your IoT devices and Home Assistant.
  • If you need multiple brokers, configure proper bridging.
  • Test MQTT messages with mosquitto_sub and mosquitto_pub before configuring HA.
  • Set discovery: true in Home Assistant's MQTT config for auto-discovery.
  • Monitor MQTT traffic with mosquitto_sub -t "#" -v during troubleshooting.

Common Mistakes with assistant mqtt bridge

  1. Using return to exit a function early instead of wrapping a pure value in the monad
  2. Mixing let bindings with <- bindings in do notation, producing type errors
  3. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors

These mistakes appear frequently in real-world HOME code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

Does Home Assistant include an MQTT broker?

No — Home Assistant does not include an MQTT broker. You need to install Mosquitto (via the add-on or separately) as the broker. HA connects to it as a client.

What MQTT topics does Home Assistant use?

Home Assistant listens to the homeassistant/ prefix for discovery messages. Individual devices publish to their own topics (e.g., sensor/temperature). You can configure custom topics in the MQTT integration.

Why are MQTT messages showing on the broker but not in HA?

Home Assistant must be subscribed to the correct topic prefix. Check discovery: true and birth_message/will_message settings. Also ensure the payload format matches Home Assistant's MQTT discovery specification.


DodaTech — MQTT that speaks Home Assistant's language.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro