Skip to content

Zigbee2MQTT

Zigbee2MQTT allows you to use your Zigbee devices without the need for proprietary bridges or gateways. It bridges events from the Zigbee network to the Mosquitto MQTT broker, which are then discovered by Home Assistant.

This module exists in modules/nixos/services/zigbee2mqtt.nix, but it is currently disabled in hosts/nixos/configuration.nix.

  • Coordinator: SONOFF Zigbee 3.0 USB Dongle Plus.
  • Connection: Local USB Port.
  • Path: /dev/serial/by-id/usb-...
  • Reason for Migration: Improved stability and lower latency. By using USB, we eliminate dependencies on internal network routing and static IPs (iotDongleIp).
  • Coordinator: SONOFF Zigbee/Thread PoE Dongle MAX (Dongle-M).
  • Connection: Ethernet/PoE (Remote TCP Bridge).
  • Port: tcp://192.168.1.101:6638.
  • Coordinator: Texas Instruments CC2531 USB Stick.
PortProtocolDescription
8080HTTPWeb Interface (Frontend)
6638TCPRemote Zigbee-over-TCP (Default for Dongle-M)

The Web UI is accessible externally via the Cloudflare Tunnel:

  • URL: https://zigbee2mqtt-home.javiersc.com
  • Internal: http://localhost:8080

MQTT credentials are required to connect to Mosquitto.

Secret PathKeyEnvironment Variable
op://Homelab/Mosquito/usernameusernameZIGBEE2MQTT_CONFIG_MQTT_USER
op://Homelab/Mosquito/passwordpasswordZIGBEE2MQTT_CONFIG_MQTT_PASSWORD
  • Paths: /var/lib/zigbee2mqtt (Device database and state).
  • Exclusions: *.log, configuration_backup_*.yaml, log/.

[!IMPORTANT] Coordinator Migration: When moving from a CC2531 (Z-Stack) to a Dongle-M (EZSP/Ember), you MUST wipe the /var/lib/zigbee2mqtt directory. The backup files from the old coordinator are incompatible and will prevent the service from starting.

If Zigbee2MQTT cannot reach the coordinator, ensure the Dongle is powered via PoE and its IP is fixed to 192.168.1.101 with port 6638 enabled in its web interface.

Terminal window
journalctl -u zigbee2mqtt -f

If you decide to go back to a network-based coordinator (like the Dongle-M):

  1. Add the coordinator IP as an explicit option or value in the Zigbee2MQTT service module.
  2. Update modules/nixos/services/zigbee2mqtt.nix to use tcp://<ip>:6638 as the zigbeePort.
  3. Ensure the device has a static IP lease in your router.
  1. Access the Web UI.
  2. Click “Permit join (All)”.
  3. Put your device in pairing mode (e.g., hold the reset button for 5 seconds).
  4. The device should appear in the list.