Why can't I start zigbee2mqtt?

Added a Sonoff Zigbee 3.0 USB dongle to my USB 2.0 hub. Using HAOS. The new dongle joins an existing Sonoff Zigbee 3.0 dongle and a Z-Wave dongle. Lots of Zigbee devices successfully attached to 1st Sonoff dongle. Want to experiment with Z2M but having trouble getting the addon to start without errors.

Here’s some info.

Configuration File:

homeassistant: false
data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: '-d -d'
  log: false
# Let new devices join our zigbee network
permit_join: true
mqtt:
  server: 192.168.1.103:1883
  user: harry1
  password: Hidden
  base_topic: zigbee2mqt
# Zigbee Adapter path
serial:
  port: /dev/ttyUSB2
frontend:
  port: 8080
zigbee_herdsman_debug: true

Error log:

[13:30:29] INFO: Preparing to start...
[13:30:29] INFO: Socat not enabled
[13:30:30] ERROR: Got unexpected response from the API: Service not enabled
[13:30:30] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2023-06-07 13:30:33: Logging to console and directory: '/config/zigbee2mqtt/log/2023-06-07.13-30-33' filename: log.txt
Zigbee2MQTT:info  2023-06-07 13:30:33: Starting Zigbee2MQTT version 1.31.1 (commit #unknown)
Zigbee2MQTT:info  2023-06-07 13:30:33: Starting zigbee-herdsman (0.14.117)
Zigbee2MQTT:error 2023-06-07 13:30:33: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-06-07 13:30:33: Failed to start zigbee
Zigbee2MQTT:error 2023-06-07 13:30:33: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-06-07 13:30:33: Exiting...
Zigbee2MQTT:error 2023-06-07 13:30:33: Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:75:22)
    at /app/node_modules/@serialport/stream/dist/index.js:111:18

Info on USB ports:

Pic2

i get this when the zigbee2usb cannot be found.

And just one advice, don’t use

port: /dev/ttyUSB2

but use by device ID
(as device ports sometimes seem to change numbering, byID never changes :thinking:

What do you mean by “when the zigbee2usb cannot be found”. Do you mean the addon?

I changed the port reference as below as per your suggestion:

homeassistant: false
data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: '-d -d'
  log: false
# Let new devices join our zigbee network
permit_join: true
mqtt:
  server: 192.168.1.103:1883
  user: harry1
  password: Hidden
  base_topic: zigbee2mqt
# Zigbee Adapter path
serial:
  port: /dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0
frontend:
  port: 8080
zigbee_herdsman_debug: true

and still got this:

[13:54:48] INFO: Preparing to start...
[13:54:48] INFO: Socat not enabled
[13:54:49] ERROR: Got unexpected response from the API: Service not enabled
[13:54:49] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2023-06-07 13:54:52: Logging to console and directory: '/config/zigbee2mqtt/log/2023-06-07.13-54-52' filename: log.txt
Zigbee2MQTT:info  2023-06-07 13:54:52: Starting Zigbee2MQTT version 1.31.1 (commit #unknown)
Zigbee2MQTT:info  2023-06-07 13:54:52: Starting zigbee-herdsman (0.14.117)
Zigbee2MQTT:error 2023-06-07 13:55:12: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-06-07 13:55:12: Failed to start zigbee
Zigbee2MQTT:error 2023-06-07 13:55:12: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-06-07 13:55:12: Exiting...
Zigbee2MQTT:error 2023-06-07 13:55:12: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:103:27)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/app/lib/zigbee.ts:58:27)
    at Controller.start (/app/lib/controller.ts:101:27)
    at start (/app/index.js:107:5)

The error message has changed, it may have elimiated the port confusion, but still a lot of errors.

sorry, that is about how far i can help…

It should be possible to setup logging level to debug, maybe that sheds sone light on it?

Unfortunately I will have to give up on Zigbee2mqtt. Shouldn’t be so hard with HAOS, very well supported coordinators, system completely up to date.

Homeassistant is not for the faint of heart, and this community is not great for beginners.

1 Like

@harryfine
Have you tried enabling the zigbee2mqtt debug on?

Enabling zigbee-herdsman debug logging
If you want to troubleshoot in more depth problems with your zigbee devices, sometimes you must enable DEBUG option on Zigbee2MQTT startup. To do this you must set zigbee_herdsman_debug to true.

zigbee_herdsman_debug: true
[21:11:20] INFO: Preparing to start...
[21:11:20] INFO: Socat not enabled
[21:11:20] INFO: Zigbee Herdsman debug logging enabled
[21:11:21] INFO: Starting Zigbee2MQTT...

It is on I think. It’s in the configuration file in the last line. Take a look.

But I also have an underlying problem that sounds hardware based, because once I try to run the add-on a few times, give up due to errors, shut down, remove second Sonoff controller dongle and re-boot, my Zigbee home automation doesn’t work, I have to refresh it. I read that there was no issue using two of the same, but the second one seems to be trying to connect to my Zigbee devices.

So I think figuring out why that happens is likely a prerequisite for dealing with the errors. Unless they are related.

I also see a lot of people putting this in their configuration file, but not sure if it’s necessary, correct or if there is an integration I need:

adapter: deconz

Uhm, you want to use 2 coordinators with the same integration?

No, one with z2a (the existing one) and one for z2m which uses the add-on. And I was told so many times this would not be an issue.

If you have 2 identical adapters, both could have the same /dev/serial/by-id

1 Like

Well noticed @francisp :grin:

And you are very right…and by usb_id is not reliable, as they might change after a reboot :thinking:

Better would be 2 different sticks, but i wonder why 2 zigbee controllers??

Question, on what hardware is it running??

From what I’ve seen, I believe you are correct. Serial/by-id is a new concept for me. I did some searching in the shell, looking for /dev/serial/by-id* dmesg | grep USB* and ha hw info | grep USB, and I found that there were two identical serial by id. Being new to the concept, I didn’t understand that, I thought perhaps one wasn’t showing up, I didn’t understand how they could be the same. People kept saying don’t use /tty/USBx or /dev/tty/ACM0, so I went with the advice.

Also not sure if I needed the adapter: deconz, or if my Sonoff needed something different.

So if they have the same ID, is there a solution, or will buying someone else’s adapter be necessary?

The reason i asked is because i used to run my HA on HyperV along with a CC2531 zigbee usb.

The issue there was, HyperV doesn’t support USB, so i looked for a different solution, i used the usb port of the hosting machine, and a ser2net to set up the connection with zigbee2mqtt…

serial:
  port: tcp://10.0.0.250:5656

That worked fine, until my cc2531 broke down, and i replaced it with a ConbeeII, and since it requires decons it didn’t work over tcp anymore😕

So i moved to VMware, which does support usb

Two zigbee controllers because I thought a second one was needed to get z2m up and running. I read that you couldn’t run both z2a and z2m off the same stick, but you could use 2 sticks, and they could be the same brand. What should I have purchased?

It’s running on an Intel NUC, running HAOS, with an external powered USB 2.0 hub for the sticks.

Except for the first line, I didn’t understand a word of the following: :blush:

The reason i asked is because i used to run my HA on HyperV along with a CC2531 zigbee usb.

The issue there was, HyperV doesn’t support USB, so i looked for a different solution, i used the usb port of the hosting machine, and a [ser2net](https://community.home-assistant.io/t/hassos-in-hyper-v-is-it-possible-to-install-usb-rediector-or-something-similar-for-usb-support/212136/2) to set up the connection with zigbee2mqtt…

serial:
port: tcp://10.0.0.250:5656


That worked fine, until my cc2531 broke down, and i replaced it with a ConbeeII, and since it requires decons it didn’t work over tcp anymore😕

So i moved to VMware, which does support usb

never mind… you are not running ha on a virtual machine, so not applicable in your case…

erm, what you said

It should be possible to run serial by usb_id (the first option you had issue’s with), but the ID could change after a reboot…

You could also take a whole other approach (actually my very 1st solution when I still ran under HyperV)

Not really what I was trying to do, wanted to play with z2m and move a couple of devices over, but thank you for trying.

If both serial by ID’s are the same, it’s just going to screw up when z2m writes to that port.

In this case, you have to use these, because serial/by_id does not differentiate between the 2 sticks