Zigbee2mqtt Error while starting zigbee-herdsman

Hi,

I having the following error in the zigbee2mqtt repeatedly:

Zigbee2MQTT:info  2020-09-07 15:43:34: Logging to console and directory: '/share/zigbee2mqtt/log/2020-09-07.15-43-33' filename: log.txt
Zigbee2MQTT:info  2020-09-07 15:43:46: Starting Zigbee2MQTT version 1.14.4 (commit #unknown)
Zigbee2MQTT:info  2020-09-07 15:43:46: Starting zigbee-herdsman...
Zigbee2MQTT:error 2020-09-07 15:43:49: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-09-07 15:43:49: Failed to start zigbee
Zigbee2MQTT:error 2020-09-07 15:43:49: Exiting...
Zigbee2MQTT:error 2020-09-07 15:43:49: Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port'
    at Znp.<anonymous> (/zigbee2mqtt-1.14.4/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:136:32)
    at Generator.next (<anonymous>)
    at /zigbee2mqtt-1.14.4/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/zigbee2mqtt-1.14.4/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:23:12)
    at SerialPort.<anonymous> (/zigbee2mqtt-1.14.4/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:134:49)
    at SerialPort._error (/zigbee2mqtt-1.14.4/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /zigbee2mqtt-1.14.4/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm
 ERR! code ELIFECYCLE
npm ERR! 
errno 1
npm
 ERR!
 [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR!
 This is probably not a problem with npm. There is likely additional logging output above.
npm
 ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-07T12_43_49_644Z-debug.log
2020-09-07T15:43:51: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2020-09-07T15:43:51: PM2 log: App [npm:0] starting in -fork mode-
2020-09-07T15:43:52: PM2 log: App [npm:0] online
> [email protected] start /zigbee2mqtt-1.14.4
> node index.js

I get this sometimes when I reboot, never worked out why, but to fix it (presuming your problem is the same as mine) stop the addon, unplug the USB, count to 10, plug it back in, restart the addon.

If that doesnā€™t work Iā€™m out of suggestions, but always works for me here.

4 Likes

Thank you. I can remove the issue by restart of zigbee2mqtt addon. However, it resurfaces again in few days.I donā€™t know what triggers it!

Nor me. As I say it only happens for me after reboots, and even then itā€™s only occasionally so I have no idea :man_shrugging:

This is happening to me, moved from rpi 3b to 4 with ssd recently, ever solve this?

Change in your Zigbee2MQTT configuration the way you adress your Zigbee USB Stick from ā€œ/dev/ttyxxxxā€ to " /dev/serial/ by-id /xxxx" if itā€™s not already done. :wink:

2 Likes

Yes, ive always set it up that way, same with my zwave stick, that way I can plug them in either port.

Im having same issue as OP. Always get the ā€˜cannot lock portā€™ error.

I bought a Sonoff adapter since its recommended to be used with Zigbee2MQTT and still same thing. Im unplugged all other sticks just to rule them out as a conflictā€¦


What is tour setup? A Rpi4 with HAOS or?
The sonoff, have you firmware upgraded it?
Have you checked that nothing else is using the dongle, like ZHA being installed as it detects the sonoff?
Do you use a USB cable extender?

It means another process is already using the dongle (perhaps ZHA?):

Using home assistant blue.

Did not do any upgrades to Sonoff. Straight outta the box.

I dont know how to check if anything else is using it. I do/did have ZHA installed that I currently use with my Nortek stick. But I went into my Integrations and i disabled ZHA, then restarted host.

Yes, I use a 4" USB cable extender.

Have a look in this thread for firmware upgrade of the dongle, as a try. Im not sure this is the problem as it indicates ZHA is using the port, however with ZHA disabled this should not happen

Well its working now, but i changed two things so unsure if it was one or both.

  1. I upgraded as you suggested.
  2. I enabled ZHA but then plugged in my Nortek stick first. THinking that if ZHA was busy with Nortek, he wouldnt have time to lock the sonoff.
1 Like

Iā€™m trying to set up Zigbee2mqtt, but can not get is running

I have the Zigbee Conbee II and running HA on a mini pc.

Also got the error message, and started to debug

This is the log output:

2022-07-16T14:43:09.449Z zigbee-herdsman:deconz:driver Serialport opened
2022-07-16T14:43:09.450Z zigbee-herdsman:controller:log Started with result ā€˜resumedā€™
2022-07-16T14:43:09.450Z zigbee-herdsman:controller:log Injected database: true, adapter: true
2022-07-16T14:43:09.458Z zigbee-herdsman:deconz:driver send read parameter request from queue. seqNr: 1 paramId: 1
2022-07-16T14:43:12.441Z zigbee-herdsman:deconz:adapter checking coordinator simple descriptor
2022-07-16T14:43:12.447Z zigbee-herdsman:deconz:driver DATA_REQUEST - destAddr: 0x0 EP:0 SeqNr. 2 request id: 1
2022-07-16T14:43:19.459Z zigbee-herdsman:deconz:driver Timeout for request - CMD: 0xa seqNr: 1
Zigbee2MQTT:error 2022-07-16 16:43:19: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-07-16 16:43:19: Failed to start zigbee
Zigbee2MQTT:error 2022-07-16 16:43:19: Check Zigbee2MQTT fails to start | Zigbee2MQTT for possible solutions
Zigbee2MQTT:error 2022-07-16 16:43:19: Exitingā€¦
Zigbee2MQTT:error 2022-07-16 16:43:19: undefined
2022-07-16T14:43:19.488Z zigbee-herdsman:deconz:driver send read device state from queue. seqNr: 3

Somebody knows what is not working? Seems something with this:

2022-07-16T14:43:12.447Z zigbee-herdsman:deconz:driver DATA_REQUEST - destAddr: 0x0 EP:0 SeqNr. 2 request id: 1
2022-07-16T14:43:19.459Z zigbee-herdsman:deconz:driver Timeout for request - CMD: 0xa seqNr: 1

No idea what it means and what to do

Config:

mqtt:
server: mqtt://core-musquitto
user: mqtt-user
password: myps
serial:
port: >-
/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2487124-if00
adapter: deconz
advanced:
channel: 25
zigbee_herdsman_debug: true

Any solutions to this ?

VIRTUAL BOX
Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Frontend 20221213.1 - latest

Zigbee2MQTT [1.28.4]


2022-12-28T13:10:22.765Z zigbee-herdsman:adapter:ezsp:uart Opening SerialPort with /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20220815162838-if00 and {"baudRate":115200,"rtscts":false,"autoOpen":false}
2022-12-28T13:10:22.781Z zigbee-herdsman:adapter:ezsp:erro Reset error Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:90:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/lib/index.js:198:14)
    at /app/node_modules/@serialport/stream/lib/index.js:242:12
2022-12-28T13:10:22.782Z zigbee-herdsman:adapter:ezsp:driv Pause 30sec before try 2
2022-12-28T13:10:23.042Z zigbee-herdsman:adapter:ezsp:ezsp Time to watchdog ... 1
2022-12-28T13:10:23.042Z zigbee-herdsman:adapter:ezsp:ezsp ==> nop: null

2022-12-28T13:10:23.620Z zigbee-herdsman:adapter:ezsp:uart Opening SerialPort with /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20220815162838-if00 and {"baudRate":115200,"rtscts":false,"autoOpen":false}

2022-12-28T13:10:23.633Z zigbee-herdsman:adapter:ezsp:erro Reset error Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:90:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/lib/index.js:198:14)
    at /app/node_modules/@serialport/stream/lib/index.js:242:12
2022-12-28T13:10:23.633Z zigbee-herdsman:adapter:ezsp:driv Pause 60sec before try 14
2022-12-28T13:10:24.461Z zigbee-herdsman:adapter:ezsp:driv Reset connection. Try 4
2022-12-28T13:10:24.461Z zigbee-herdsman:adapter:ezsp:driv Stop driver
2022-12-28T13:10:24.461Z zigbee-herdsman:adapter:ezsp:ezsp Stop ezsp
2022-12-28T13:10:24.461Z zigbee-herdsman:adapter:ezsp:ezsp Close ezsp
2022-12-28T13:10:24.461Z zigbee-herdsman:adapter:ezsp:driv Close driver

I donā€™t use ZHA.
I get this error once a day. Restarting Z2M helps meā€¦
I couldnā€™t find a solution to my problem

Something similar happens to me. Only solution is reboot the entire virtualbox machine. I guess the usb stops working for some reason. Very annoying really

I get this but much more frequently. It basically makes zigbee2mqtt unusable. Does anyone have any idea how to solve it?
I get this log message:
2024-01-27T15:19:29.076Z zigbee-herdsman:adapter:ezsp:erro Connection attempt 3 error: Error: Error while opening serialport ā€˜Error: Error Resource temporarily unavailable Cannot lock portā€™
I do not have ZHA installed (as far as I know!)