How to Zigbee2MQTT in a dockerized Home Assistant

Here my description/documentation for my Home-Assistant installation with Zigbee. I have the following setup:

  • Dockerized Home Assistant. (So no option to install add-ons.)
  • Mosquitto MQTT already operating in a separate docker.
  • A SMLIGHT SLZB-06Mg24 ethernet Zigbee controller

The SMLIGHT zigbee controller was already running in combination with the ZHA (Zigbee Home Automation) Integration, but since Zigbee2MQTT has a wider support, now making the choice to migrate to Zigbee2MQTT.

Note: While migrating i (mis)-used the european AI tool “Le Chat” a lot.

Docker setup

To start with the migration we have to install the Zigbee2MQTT Add on as a docker. To facilitate this i ended up with the following docker-compose.yml, putting mosquitto and Zigbee2MQTT together:

version: '3.8'
services:
  mosquitto:
    image: eclipse-mosquitto:latest
    container_name: mosquitto
    restart: always
    ports:
      - "1883:1883"  # MQTT-poort
    volumes:
      - /opt/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
      - /opt/mosquitto/config/passwd:/mosquitto/config/passwd
      - /opt/mosquitto/data:/mosquitto/data/
      - /opt/mosquitto/log:/mosquitto/log/
    networks:
      - homeautomation
  zigbee2mqtt:
    image: koenkk/zigbee2mqtt:latest
    container_name: zigbee2mqtt
    restart: unless-stopped
    ports:
      - "8080:8080"  # Web-interface
    environment:
      - TZ=Europe/Amsterdam
    volumes:
      - /opt/mosquitto/z2mqtt:/app/data  # Configuratie en data location.
    networks:
      - homeautomation
    depends_on:
      - mosquitto
networks:
  homeautomation:
    driver: bridge

In this stack-config is mosquitto started first, and after mosquitto is correctly started zigbee2mqtt is started.

Configuring Zigbee2MQTT

Before starting up Zigbee2MQTT, you need to do 2 things:

  • create your zigbee2mqqt configuration.yaml, which is placed in the /opt/mosquitto/mqtt/ folder:
    Special attention for the homeassistant settings: these are absolutely needed. Struggled to long to get this working, as AI did not give the correct position for this setting….
  • Stop and disable the ZHA integration inside HA, as they will both try to connect to the SLZB-06Mg24. It is a good idea the create a backup on forehand.
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://mosquitto
  user: <your mqtt user>
  password: <your mqtt password>
# HINT: serial config below is copied from de SLZB config page (http://192.168.x.x/z2m_zha), this works better than other suggestions.
serial:
  # Location of SLZB-06Mg24
  port: tcp://192.168.X.X:6638
  baudrate: 115200
  adapter: ember
  # Disable green led?
  #disable_led: false
frontend:
    enabled: true
homeassistant:
  enabled: true
advanced:
  # Set output power to max 20
  transmit_power: 20
  network_key: GENERATE  # Let Zigbee2MQTT generate a new network-key (Wil be added to this config file)
version: 4

To stop/start the docker stack you use the following commands:

 docker-compose down
docker-compose up -d

When the dockers are started, you kan check if zigbee2mqtt is started correctly:

docker logs zigbee2mqtt
Using '/app/data' as data directory
Starting Zigbee2MQTT without watchdog.
[2026-01-28 13:21:13] info:     z2m: Logging to console, file (filename: log.log)
[2026-01-28 13:21:13] info:     z2m: Starting Zigbee2MQTT version 2.7.2 (commit #3a49c95786c2fba749e7696aab4cc38e467d2c4c
)
[2026-01-28 13:21:13] info:     z2m: Starting zigbee-herdsman (8.0.1)
[2026-01-28 13:21:13] info:     zh:ember: Using default stack config.
[2026-01-28 13:21:13] info:     zh:ember: ======== Ember Adapter Starting ========
[2026-01-28 13:21:13] info:     zh:ember:ezsp: ======== EZSP starting ========
[2026-01-28 13:21:13] info:     zh:ember:uart:ash: ======== ASH Adapter reset ========
[2026-01-28 13:21:13] info:     zh:ember:uart:ash: Socket ready
[2026-01-28 13:21:13] info:     zh:ember:uart:ash: ======== ASH starting ========
[2026-01-28 13:21:15] info:     zh:ember:uart:ash: ======== ASH connected ========
[2026-01-28 13:21:15] info:     zh:ember:uart:ash: ======== ASH started ========
[2026-01-28 13:21:15] info:     zh:ember:ezsp: ======== EZSP started ========
[2026-01-28 13:21:15] info:     zh:ember: Adapter EZSP protocol version (14) lower than Host. Switched.
[2026-01-28 13:21:15] info:     zh:ember: Adapter version info: {"ezsp":14,"revision":"8.0.2 [GA]","build":397,"major":8,"minor":0,"patch":2,"special":0,"type":170}
[2026-01-28 13:21:15] info:     zh:ember: [STACK STATUS] Network up.
[2026-01-28 13:21:15] info:     zh:ember: [INIT TC] Adapter network matches config.
[2026-01-28 13:21:15] info:     zh:ember: [CONCENTRATOR] Started source route discovery. 1248ms until next broadcast.
[2026-01-28 13:21:15] info:     z2m: zigbee-herdsman started (resumed)
[2026-01-28 13:21:15] info:     z2m: Coordinator firmware version: '{"meta":{"build":397,"ezsp":14,"major":8,"minor":0,"patch":2,"revision":"8.0.2 [GA]","special":0,"type":170},"type":"EmberZNet"}'
[2026-01-28 13:21:15] info:     z2m: Currently 0 devices are joined.
[2026-01-28 13:21:15] info:     z2m: Connecting to MQTT server at mqtt://mosquitto
[2026-01-28 13:21:16] info:     z2m: Connected to MQTT server
[2026-01-28 13:21:16] info:     z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
[2026-01-28 13:21:16] info:     z2m: Zigbee2MQTT started!

So that is looking good! With following command you can also see if de zigbee2MQTT sends messages to mosquitto: (I usually run this on a seperated ssh screen.)

mosquitto_sub -v -h docker -u <mqtt_user> -P <password> -t '#' | ts
# ts adds a timestamp before the message comes in.

Also, after enabling the frontend (which i did not at first) you can use your web-browser to look there: http://192.168.x.x:8080/. The sad thing is that i lost all my connected devices (i worked with ZHA first)… So i have to reinstall them all :-(.

(Re)connecting zigbee devices

To (re)connect your devices, you need to open de GUI, and klick on the left-menu below on the “Join Allow” button. After that, you can add new devices.

As i was migrating, i had to find out for all my devices how to do the factory-reset (or more). You can find the cheat-codes how to do that here.

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *