Docker zigbee2mqtt fails and prevents comminucation with ZHA devices

I’m a new user of HA and I’m trying to set up zigbee2mqtt.

Home assistant, Mosquitto and zigbee2mqtt are all running in docker on a Synology NAS. I have a Sonoff USB 3.0 dongle which I have re-flashed with Koenkk CC1352P2_CC2652P_launchpad_coordinator_20220219 firmware.

I can successfully link a couple of Zigbee smart plugs using ZHA. However, as soon as I try to start zigbee2mqtt, it fails (logs below) and prevents ZHA from communicating with the previously working Zigbee devices.

For a short time I did have a device connected through zigbee2mqtt (as can be seen in the configuration.yaml), but I did something that now causes the whole process to fail. Stupidly I wasn’t doing one thing at a time and noting it all down. Unfortunately being new to the Zigbee devices and HA I’m now rather flailing in the dark!

docker-compose.yml:

version: '3.8'
services:
  mqtt:
    image: eclipse-mosquitto:2.0
    restart: unless-stopped
    volumes:
      - "./mosquitto-data:/mosquitto"
    ports:
      - "1883:1883"
      - "9001:9001"
    command: "mosquitto -c /mosquitto-no-auth.conf"

  zigbee2mqtt:
    container_name: zigbee2mqtt
    restart: unless-stopped
    image: koenkk/zigbee2mqtt
    volumes:
      - ./zigbee2mqtt-data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      - 8080:8080
    environment:
      - TZ=Europe/London
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0

configuration.yaml

permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://mqtt
serial:
  port: /dev/ttyUSB0
frontend:
  port: 8080
homeassistant: true
advanced:
  network_key:
    - 53

    - 226
devices:
  '0xb4e3f9fffebda8cd':
    friendly_name: 'TRV Andy Study'

In the log I get messages:

info  2022-06-06 15:43:20: Logging to console and directory: '/app/data/log/2022-06-06.15-43-18' filename: log.txt
info  2022-06-06 15:43:21: Starting Zigbee2MQTT version 1.25.1 (commit #3f6a137)
info  2022-06-06 15:43:21: Starting zigbee-herdsman (0.14.27)
error 2022-06-06 15:43:42: Error while starting zigbee-herdsman
error 2022-06-06 15:43:42: Failed to start zigbee
error 2022-06-06 15:43:42: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
error 2022-06-06 15:43:42: Exiting...
error 2022-06-06 15:43:42: Error: SRSP - SYS - getExtAddr after 6000ms
    at Timeout._onTimeout (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:64:35)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

info  2022-06-06 15:43:51: Logging to console and directory: '/app/data/log/2022-06-06.15-43-49' filename: log.txt
info  2022-06-06 15:43:51: Starting Zigbee2MQTT version 1.25.1 (commit #3f6a137)
info  2022-06-06 15:43:51: Starting zigbee-herdsman (0.14.27)
error 2022-06-06 15:43:53: Failed to call 'Frontend' 'stop' (TypeError: Cannot read properties of null (reading 'clients')
    at Frontend.stop (/app/lib/extension/frontend.ts:59:39)
    at Controller.callExtensions (/app/lib/controller.ts:316:40)
    at Controller.stop (/app/lib/controller.ts:191:9)
    at stop (/app/index.js:114:5)
    at process.handleQuit (/app/index.js:120:9))

I looked at the suggested link, but as I’d already reflashed the dongle, and have access to the port for ZHA I could see how it would help.

Any help would be gratefully received.
Thanks

How many sticks do you have ? You can only use one Zigbee stack (either ZHA or Zigbee2mqtt) at the same time using the same stick. Only one stack can open the serial port. Of cause, if you have 2 sticks, this does not apply.

1 Like

Just the one stick! So I presume that means it’s either zigbee2mqtt OR ZHA unless I get another stick.

That makes me wonder if I had zigbee2mqtt working when ZHA hadn’t been started - I was rather trying to get everything working at the same time!

That makes sense.

Yes.

Also be aware that Zigbee devices paired with one stick cannot be used at the same time by the other stick. Each stick creates its own, separate, mesh network.

I’ve just tried disabling ZHA and sure enough zigbee2mqtt started working!

Of course it seems obvious now, but I was looking for the complicated answers…

Thanks guys for being lightning quick with the response - I just wish I had asked earlier!