Smart home in practice · intermediate

Should you use ZHA or Zigbee2MQTT?

How ZHA and Zigbee2MQTT differ in architecture, device support and the MQTT dependency, and how to choose and place a Zigbee coordinator.

Close-up of a USB device on a white surface

Photo: Barry A / Unsplash

After reading this article you will be able to:

  • Explain how ZHA and Zigbee2MQTT connect a Zigbee coordinator to Home Assistant
  • Choose a USB or network coordinator and check that both stacks support its firmware
  • Reduce interference with a USB 2.0 port, an extension cable and a sensible channel
On this page
  1. What is a Zigbee coordinator, and which kinds are there?
  2. How do the two stacks differ in practice?
  3. Which one supports more devices?
  4. What does the MQTT dependency mean?
  5. How do you avoid interference?
  6. Can you switch later?
  7. Where to go next

Use ZHA when you want the simplest setup: it is built into Home Assistant, needs no other service and handles the common Zigbee devices well. Use Zigbee2MQTT when you want its device converters and its own web interface, when you want the Zigbee network to keep running independently of Home Assistant, or when other software besides Home Assistant should read the devices over MQTT. Both drive the same kinds of Zigbee coordinator, both run locally, and either is a sound choice for a home network of a few dozen devices.

The difference is architectural. ZHA is a Home Assistant integration that talks to the radio directly. Zigbee2MQTT is a separate program that talks to the radio and publishes every device to an MQTT broker, which Home Assistant then subscribes to. The table summarizes what follows from that.

ZHAZigbee2MQTT
Where it runsInside Home AssistantSeparate service: Home Assistant app, Docker or any Linux host
Extra servicesNoneAn MQTT broker, such as Mosquitto
Non-standard devicesQuirks from ZHA Device HandlersConverters from zigbee-herdsman
InterfaceHome Assistant device pagesOwn web frontend, plus Home Assistant via MQTT discovery
Used by other softwareNoYes, by any MQTT client

What is a Zigbee coordinator, and which kinds are there?

Every Zigbee network has exactly one coordinator. It forms the network, hands out addresses and holds the network key; mains-powered devices then act as routers and extend the mesh. In Home Assistant the coordinator is a radio adapter plus the firmware that runs on it, and that firmware decides which software stacks can use it.

There are two physical forms. USB adapters plug into the Home Assistant machine; the project’s own Connect ZBT-2 is one, and the ZHA documentation lists tested third-party adapters built on Silicon Labs (EmberZNet), Texas Instruments (Z-Stack) and dresden elektronik (deCONZ) chips. Network coordinators put the same radio in a small box connected by Ethernet, so it can sit in the middle of the house while the server stays in a cupboard. The serial link between software and radio tolerates delays and packet loss poorly, which is why ZHA advises against running it over Wi-Fi, a WAN or a VPN, and the Zigbee2MQTT adapter guide warns that adapters connected over Wi-Fi may be less stable and suggests wired Ethernet.

The Zigbee2MQTT guide also lists its own firmware tiers: Z-Stack, EmberZNet and deCONZ adapters are recommended, ZiGate is no longer maintained and ZBOSS support is experimental. Check that the adapter you buy appears in the supported list of both projects, so that you keep the option of switching later.

How do the two stacks differ in practice?

How ZHA and Zigbee2MQTT connect Zigbee devices to Home Assistant Two lanes. In the ZHA lane, Zigbee devices reach a coordinator and the ZHA integration inside Home Assistant drives the coordinator directly. In the Zigbee2MQTT lane, the coordinator is driven by Zigbee2MQTT, a separate service with its own web interface, which publishes to an MQTT broker; Home Assistant and any other MQTT client subscribe to the broker. ZHA: ONE PROCESS Devices sensors, bulbs Coordinator USB or network Home Assistant ZHA integration: radio library, quirks, entities ZIGBEE2MQTT: THREE PROCESSES Devices sensors, bulbs Coordinator USB or network Zigbee2MQTT own web UI MQTT broker e.g. Mosquitto Home Assistant MQTT integration other MQTT clients can subscribe too Both drive the same coordinators; Zigbee2MQTT adds a broker between radio and Home Assistant.
ZHA drives the coordinator from inside Home Assistant. Zigbee2MQTT drives it as a separate service and publishes devices to an MQTT broker, which Home Assistant and any other MQTT client read.

With ZHA, pairing, renaming and removing devices happen in the normal Home Assistant interface, and a Zigbee device looks like any other device. Restarting Home Assistant restarts the Zigbee stack with it. Updates arrive with Home Assistant releases.

Zigbee2MQTT has its own frontend for pairing, a network map and device settings. It connects to Home Assistant through MQTT discovery: once the MQTT integration is set up, devices appear in Home Assistant’s device registry automatically. Because it is a separate process, you can restart Home Assistant without touching the Zigbee network, run Zigbee2MQTT on a different machine nearer the middle of the house, or feed the same devices to Node-RED or a time-series database directly.

Which one supports more devices?

Both support devices that follow the Zigbee specification. The differences appear with devices that use manufacturer-specific clusters or behave oddly. ZHA handles them with quirks, small Python handlers from the ZHA Device Handlers project, and its documentation notes that Zigbee2MQTT uses an equivalent mechanism, the zigbee-herdsman converters.

Zigbee2MQTT publishes a searchable list of supported devices, which counted 5,798 devices from 608 vendors when checked for this guide; each entry shows which features the converter exposes. ZHA does not publish an equivalent count. The community-maintained Zigbee Device Compatibility Repository reports device compatibility across ZHA, Zigbee2MQTT and other gateways. Before buying an unusual device, look it up in both places: support for the basic function is common, but extra features such as a sensitivity setting or a second relay channel may be supported by only one stack.

What does the MQTT dependency mean?

Zigbee2MQTT needs an MQTT broker; its getting started guide recommends Mosquitto. On Home Assistant OS that means two more apps (the broker and Zigbee2MQTT itself, which is installed from its own repository) and the MQTT integration. On Home Assistant Container you run both as separate containers.

That is more to configure, update and back up, and one more component that can fail. In exchange you get a clean interface: every device has topics you can read and write, which is useful for debugging and for integrating anything that speaks MQTT. If that flexibility has no use for you, ZHA’s single process is simpler to keep running.

How do you avoid interference?

Many Zigbee problems that look like software faults turn out to be radio problems, and both projects give similar advice. The ZHA documentation recommends plugging the adapter into a USB 2.0 port rather than USB 3.x, because USB 3 ports, computers and peripherals are known sources of interference, and placing it on a shielded USB extension cable away from the computer. Zigbee2MQTT’s network range guide notes that a 50 cm extension cable is already enough to reduce interference and warns against placing the adapter near USB or HDMI ports.

Zigbee shares the 2.4 GHz band with Wi-Fi. ZHA generally recommends Zigbee channels 15, 20 or 25 and advises against changing the channel once the network is built; changing it in Zigbee2MQTT may require re-pairing some devices. Keep the coordinator away from Wi-Fi access points, and add mains-powered routers (plugs, in-wall switches with a neutral wire) before blaming a sensor that drops off.

Can you switch later?

Yes, but plan it as a small project. Only one stack can use a coordinator at a time, so the switch happens all at once rather than device by device, and the devices come back into Home Assistant as new entities, so automations and dashboards that reference them need updating. Choosing an adapter supported by both projects keeps the hardware usable whichever way you go.

Where to go next

Topics: Zigbee, Home Assistant, Zigbee2MQTT, ZHA, MQTT, comparison

Diagram