Guide ยท Zigbee

How to Set Up Zigbee2MQTT with Home Assistant

Updated March 2025 ยท 14 min read ยท By SmartWired Editors

๐Ÿ“‹ Table of Contents

  1. What Is Zigbee2MQTT and Why Use It?
  2. What You Need
  3. Step 1: Flash the Sonoff Dongle (if needed)
  4. Step 2: Install Mosquitto MQTT Broker
  5. Step 3: Install Zigbee2MQTT
  6. Step 4: Configure Zigbee2MQTT
  7. Step 5: Pair Your First Device
  8. Step 6: Use Devices in Home Assistant
  9. Tips, Troubleshooting & Best Practices
  10. Verdict

What Is Zigbee2MQTT and Why Use It?

Zigbee is a low-power wireless protocol used by hundreds of smart home devices โ€” sensors, bulbs, switches, plugs, and more. Brands like IKEA, Aqara, Philips Hue, Sonoff, and Tuya all make Zigbee products.

Zigbee2MQTT is open-source software that converts Zigbee device communications into MQTT messages, allowing Home Assistant to control and monitor these devices completely locally โ€” no cloud account, no proprietary hub, no internet connection required.

It's the preferred Zigbee integration for Home Assistant power users because:

The alternative is ZHA (Zigbee Home Automation), which is built into Home Assistant. ZHA is simpler to set up, but Zigbee2MQTT offers broader device support, more granular configuration, and a better advanced feature set. For serious Zigbee setups, Zigbee2MQTT wins.

What You Need

๐ŸŒŸ Pro Tip: Always use a USB extension cable (10โ€“20 cm) between your HA hub and the Zigbee dongle. USB 3.0 and other nearby electronics can cause 2.4 GHz interference that degrades Zigbee performance. Moving the dongle a few centimetres away can dramatically improve range and stability.

Choosing a Zigbee Coordinator

DongleChipMax DevicesRecommended?
Sonoff Zigbee 3.0 Dongle Plus (E)EFR32MG21200+โœ“ Best overall
Sonoff Zigbee 3.0 Dongle Plus (P)CC2652P100+โœ“ Great value
HUSBZB-1EM3581 / EFR3250+Zigbee + Z-Wave combo
ConBee II / PhosconCC2652100+Good alternative
Aeotec Z-Stick 7ZM5304100+Z-Wave only, not Zigbee

We recommend the Sonoff Zigbee 3.0 USB Dongle Plus. It's affordable (~$20), widely supported, works out-of-the-box with Zigbee2MQTT, and the newer "E" variant (EFR32MG21 chip) supports a router/coordinator firmware for larger networks.

Sonoff Zigbee 3.0 USB Dongle Plus

The most popular Zigbee coordinator for Home Assistant. Works out-of-the-box with Zigbee2MQTT, supports 200+ devices, and is widely available for under $20. Includes cap and comes in both +E and +P variants.

View on Amazon โ†’

As an Amazon Associate we earn from qualifying purchases.

Step 1: Flash the Sonoff Dongle (if needed)

Most Sonoff Dongle Plus units ship ready to use as a Zigbee coordinator. You generally do not need to flash the firmware before use โ€” Zigbee2MQTT will detect it automatically.

However, if you bought an older unit or want to update to the latest coordinator firmware for better stability:

For most users, skip this step and proceed directly to installing Mosquitto.

Step 2: Install Mosquitto MQTT Broker

1 Install Mosquitto Broker Add-on

In Home Assistant, navigate to Settings โ†’ Add-ons โ†’ Add-on Store. Search for "Mosquitto broker" and install it. Once installed, click Start and enable Start on boot.

2 Create an MQTT User

Navigate to Settings โ†’ People โ†’ Users and create a new user specifically for MQTT. Uncheck "Can log in" if you want it to be a service account. Note the username and password โ€” you'll need them when configuring Zigbee2MQTT.

Alternatively, the Mosquitto add-on can use HA's built-in user accounts automatically โ€” just leave the broker configuration at defaults and it will use your HA account credentials.

3 Enable MQTT Integration in HA

Go to Settings โ†’ Devices & Services. Home Assistant should automatically detect the Mosquitto broker and offer to set up the MQTT integration. Accept it and configure with your credentials. If it doesn't appear automatically, click + Add Integration and search for "MQTT".

Step 3: Install Zigbee2MQTT

4 Add the Zigbee2MQTT Repository

Zigbee2MQTT is a community add-on. In the Add-on Store, click the โ‹ฎ menu (top right) โ†’ Repositories โ†’ paste this URL:

https://github.com/zigbee2mqtt/hassio-zigbee2mqtt

Click Add, then refresh the page. You'll now see Zigbee2MQTT in the store.

5 Install Zigbee2MQTT

Find Zigbee2MQTT in the add-on store and click Install. After installation, do not start it yet โ€” configure it first.

Step 4: Configure Zigbee2MQTT

6 Find Your Dongle's Device Path

Navigate to Settings โ†’ System โ†’ Hardware. Look for your Sonoff dongle โ€” it will appear as something like /dev/ttyUSB0 or /dev/serial/by-id/usb-ITead_.... Copy the by-id path โ€” it's more reliable than ttyUSB0 which can change on reboot.

7 Edit the Zigbee2MQTT Configuration

In the Zigbee2MQTT add-on, go to Configuration tab. Edit the YAML configuration:

# Zigbee2MQTT Configuration data_path: /config/zigbee2mqtt socat: enabled: false master: pty,raw,echo=0 slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=2,keepcnt=5 options: "-d -d" log: false

Then click Save. The main configuration (coordinator path, MQTT credentials, etc.) is handled in the Z2M config file โ€” see next step.

8 Configure coordinator and MQTT in configuration.yaml

Using the File Editor add-on, navigate to /config/zigbee2mqtt/configuration.yaml (create it if it doesn't exist) and add:

homeassistant: true permit_join: true mqtt: base_topic: zigbee2mqtt server: mqtt://homeassistant.local user: YOUR_MQTT_USER password: YOUR_MQTT_PASSWORD serial: port: /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_XXXXXXXXXX-if00-port0 advanced: log_level: info network_key: GENERATE

Replace the serial port with your actual dongle path, and MQTT credentials with your own. Set network_key: GENERATE on first run โ€” Z2M will auto-generate a secure network key.

9 Start Zigbee2MQTT

Return to the Zigbee2MQTT add-on page, enable Start on boot and Watchdog, then click Start. Check the Log tab โ€” you should see it connecting to the MQTT broker and initialising the coordinator. Look for: Zigbee2MQTT started!

Step 5: Pair Your First Device

10 Open Permit Join

In HA, navigate to the Zigbee2MQTT panel in the sidebar. Click Permit join (All) โ€” this opens a 250-second window during which new devices can join the network.

11 Put Your Device in Pairing Mode

Every device has a different pairing method. Common approaches:

Check the Zigbee2MQTT supported devices list for your specific device's pairing instructions.

12 Confirm the Device Joined

Within seconds of successful pairing, the device will appear in the Z2M dashboard with an auto-generated name (e.g., 0x00158d000123abcd). Click the device to rename it to something sensible like "Living Room Motion Sensor". Done!

Step 6: Use Devices in Home Assistant

With homeassistant: true set in your Z2M config, devices are automatically discovered and added to Home Assistant via MQTT discovery. They'll appear in Settings โ†’ Devices & Services โ†’ MQTT.

From there, you can:

Tips, Troubleshooting & Best Practices

Best Practices

Common Issues

โญ SmartWired Summary

Zigbee2MQTT is the gold standard for Zigbee integration in Home Assistant. Once set up, it's rock-solid, completely local, and supports an enormous range of devices. The initial configuration takes about 30โ€“60 minutes, but the result is a Zigbee network that you own entirely โ€” no cloud accounts, no subscriptions, no vendor lock-in.

Pair it with the Sonoff Zigbee 3.0 USB Dongle Plus and you have everything you need for a professional-grade Zigbee setup at an entry-level price.

Affiliate Disclosure: SmartWired participates in the Amazon Associates Program and other affiliate programmes. We may earn a commission when you click links and make purchases, at no extra cost to you. This does not influence our editorial recommendations. Read our full disclosure.