Home Assistant Zigbee2MQTT — Complete Guide
In this tutorial, you'll learn about Home Assistant Zigbee2MQTT. We cover key concepts, practical examples, and best practices.
Hook
You have Zigbee2MQTT running as a Home Assistant add-on. The web UI shows some devices as "Online" and others as "Offline." You try to pair a new bulb, but Zigbee2MQTT does not see it. The coordinator is plugged in, the LED is blinking, but nothing works.
The Wrong Way
USB passthrough issues are common — some users pass the wrong device path or use Docker without the right permissions.
# BAD: Wrong USB device path in Docker
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
Zigbee2MQTT: Failed to open serial port /dev/ttyUSB0
Error: Error: No such file or directory
The USB coordinator may be at /dev/ttyACM0 or /dev/serial/by-id/, not /dev/ttyUSB0.
The Right Way
Identify the correct USB device path and give Zigbee2MQTT the right permissions.
# 1. Find your Zigbee coordinator
ls -la /dev/serial/by-id/
lrwxrwxrwx 1 root root 13 Jun 24 10:00 usb-Texas_Instruments_TI_CC2531_USB_CDC___0X0012345678-if00 -> ../../ttyACM0
# 2. Use the persistent by-id path
# In Zigbee2MQTT configuration.yaml:
serial:
port: /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X0012345678-if00
adapter: zstack
# 3. Check permissions on the device
ls -la /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Jun 24 10:00 /dev/ttyACM0
# 4. Add the HA user to the dialout group (for add-on installations)
sudo usermod -aG dialout homeassistant
# Or for Docker: --device /dev/ttyACM0 and --group-add dialout
# 5. Restart Zigbee2MQTT
docker restart zigbee2mqtt
Zigbee2MQTT: Connected to coordinator (CC2531)
Zigbee2MQTT: Network established — channel 15
Prevention
- Use
/dev/serial/by-id/*paths instead of/dev/ttyUSB0— they persist across reboots. - Add the Zigbee2MQTT user to the
dialoutgroup. - Keep the Zigbee coordinator on a USB extension cable away from the server case (reduces interference).
- Use a supported Zigbee coordinator (recommended: Sonoff ZBDongle-P, Texas Instruments CC2652).
- Check that no other service (like
brltty) is claiming the serial port.
Advanced Troubleshooting
Check the Logs
Most TOOL errors are logged to stdout or a dedicated log file. Check your logs first:
# Check system logs
journalctl -u tool --since "1 hour ago"
# Or check the application log
tail -50 ~/.tool/logs/error.log
Test with a Minimal Example
Create the simplest possible tool configuration to verify the base setup works:
tool --version
tool --help
If the minimal test passes, add configuration options one at a time until you find the breaking change.
Common Configuration Mistakes
- Using the wrong file path or URL in configuration
- Forgetting to restart TOOL after changing config files
- Mixing tabs and spaces in YAML configuration files
- Setting incorrect permissions on configuration directories
When to Reinstall
If none of the above resolves the issue, consider a clean reinstall:
# Backup your configuration
cp -r ~/.tool ~/.tool.bak
# Remove and reinstall
# Follow the official TOOL installation guide
This ensures you start from a known good state and can isolate the issue.
Common Mistakes with assistant zigbee2mqtt
- Misunderstanding that
Stringis[Char]with poor performance for large text operations - Using
foldlinstead offoldl'causing stack overflow on large lists - Forgetting
deriving (Show, Eq)on custom data types needed for debugging
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
DodaTech — Zigbee devices that actually connect.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro