kabbi / zigbee2mqtt-adapter

zigbee2mqtt adapter for WebThings gateway
Mozilla Public License 2.0
21 stars 13 forks source link

zigbee2mqtt not working anymore #41

Closed arist0v closed 2 years ago

arist0v commented 3 years ago

Since june, i'm unable to have zigbee2mqtt working,

i try to erase the .webthings folder to reset my data, not working.

i try to just reflash my sd card (i have the raspberry pi image on raspberry pi 3)

my hardware is conbee II usb stick

and there is the log

2021-08-29 21:38:36.521 ERROR : zigbee2mqtt-adapter: (node:1460) UnhandledPromiseRejectionWarning: Error: Command failed: npm run build 2021-08-29 21:38:36.524 ERROR : zigbee2mqtt-adapter: sh: 1: tsc: not found 2021-08-29 21:38:36.530 ERROR : zigbee2mqtt-adapter: npm ERR! code ELIFECYCLE 2021-08-29 21:38:36.532 ERROR : zigbee2mqtt-adapter: npm ERR! syscall spawn 2021-08-29 21:38:36.534 ERROR : zigbee2mqtt-adapter: npm ERR! file sh 2021-08-29 21:38:36.535 ERROR : zigbee2mqtt-adapter: npm ERR! errno ENOENT 2021-08-29 21:38:36.537 ERROR : zigbee2mqtt-adapter: npm ERR! zigbee2mqtt@1.21.0 build: tsc && node index.js writehash 2021-08-29 21:38:36.539 ERROR : zigbee2mqtt-adapter: npm ERR! spawn ENOENT 2021-08-29 21:38:36.541 ERROR : zigbee2mqtt-adapter: npm ERR! 2021-08-29 21:38:36.543 ERROR : zigbee2mqtt-adapter: npm ERR! Failed at the zigbee2mqtt@1.21.0 build script. 2021-08-29 21:38:36.545 ERROR : zigbee2mqtt-adapter: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 2021-08-29 21:38:36.547 ERROR : zigbee2mqtt-adapter: 2021-08-29 21:38:36.549 ERROR : zigbee2mqtt-adapter: npm ERR! A complete log of this run can be found in: 2021-08-29 21:38:36.550 ERROR : zigbee2mqtt-adapter: npm ERR! /home/pi/.npm/_logs/2021-08-29T20_38_36_460Z-debug.log 2021-08-29 21:38:36.552 ERROR : zigbee2mqtt-adapter: 2021-08-29 21:38:36.554 ERROR : zigbee2mqtt-adapter: at ChildProcess.exithandler (child_process.js:294:12) 2021-08-29 21:38:36.556 ERROR : zigbee2mqtt-adapter: at ChildProcess.emit (events.js:198:13) 2021-08-29 21:38:36.558 ERROR : zigbee2mqtt-adapter: at maybeClose (internal/child_process.js:982:16) 2021-08-29 21:38:36.560 ERROR : zigbee2mqtt-adapter: at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 2021-08-29 21:38:36.562 ERROR : zigbee2mqtt-adapter: (node:1460) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) 2021-08-29 21:38:36.564 ERROR : zigbee2mqtt-adapter: (node:1460) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

arist0v commented 3 years ago

also the log specified in the first one:

0 info it worked if it ends with ok 1 verbose cli [ '/home/pi/.nvm/versions/node/v10.23.0/bin/node', 1 verbose cli '/home/pi/.nvm/versions/node/v10.23.0/bin/npm', 1 verbose cli 'run', 1 verbose cli 'build' ] 2 info using npm@6.14.9 3 info using node@v10.23.0 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ] 5 info lifecycle zigbee2mqtt@1.21.0~prebuild: zigbee2mqtt@1.21.0 6 info lifecycle zigbee2mqtt@1.21.0~build: zigbee2mqtt@1.21.0 7 verbose lifecycle zigbee2mqtt@1.21.0~build: unsafe-perm in lifecycle true 8 verbose lifecycle zigbee2mqtt@1.21.0~build: PATH: /home/pi/.nvm/versions/node/v10.23.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt/node_modules/.bin:/home/pi/.nvm/versions/node/v10.23.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/webthings/gateway/node_modules/.bin:/home/pi/.nvm/versions/node/v10.23.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 9 verbose lifecycle zigbee2mqtt@1.21.0~build: CWD: /home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt 10 silly lifecycle zigbee2mqtt@1.21.0~build: Args: [ '-c', 'tsc && node index.js writehash' ] 11 info lifecycle zigbee2mqtt@1.21.0~build: Failed to exec build script 12 verbose stack Error: zigbee2mqtt@1.21.0 build: tsc && node index.js writehash 12 verbose stack spawn ENOENT 12 verbose stack at ChildProcess. (/home/pi/.nvm/versions/node/v10.23.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18) 12 verbose stack at ChildProcess.emit (events.js:198:13) 12 verbose stack at maybeClose (internal/child_process.js:982:16) 12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 13 verbose pkgid zigbee2mqtt@1.21.0 14 verbose cwd /home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt 15 verbose Linux 5.4.72-v7+ 16 verbose argv "/home/pi/.nvm/versions/node/v10.23.0/bin/node" "/home/pi/.nvm/versions/node/v10.23.0/bin/npm" "run" "build" 17 verbose node v10.23.0 18 verbose npm v6.14.9 19 error code ELIFECYCLE 20 error syscall spawn 21 error file sh 22 error errno ENOENT 23 error zigbee2mqtt@1.21.0 build: tsc && node index.js writehash 23 error spawn ENOENT 24 error Failed at the zigbee2mqtt@1.21.0 build script. 24 error This is probably not a problem with npm. There is likely additional logging output above. 25 verbose exit [ 1, true ]

Utopiah commented 2 years ago

Did you reboot your machine in June and did before that you had manually setup node to be a newer version than v10.23.0?

According to your log there is a "/home/pi/.nvm/" directory which might indicates multiple and potentially conflicting version of node.

arist0v commented 2 years ago

This issue is now on a fresh new setup.

Le dim. 12 sept. 2021 16 h 59, Fabien Benetou @.***> a écrit :

Did you reboot your machine in June and did before that you had manually setup node to be a newer version than v10.23.0?

According to your log there is a "/home/pi/.nvm/" directory which might indicates multiple and potentially conflicting version of node.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kabbi/zigbee2mqtt-adapter/issues/41#issuecomment-917709170, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSPAAAOUG2PBWPCP7VNWFLUBUIBJANCNFSM5DATLI2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Utopiah commented 2 years ago

Indeed I checked while writing this because I also had nvmrc and couldn't remember if it was due to my own tinkering or WebThings. I see that https://github.com/WebThingsIO/gateway/blob/v1.1.X/.nvmrc it pines node 10 so now I'm wondering if a dependency of this add-on has been deprecated and thus doesn't work with WebThings anymore.

Utopiah commented 2 years ago

I see that mqtt 4 deprecated node end of life versions, so 10 is out. Maybe that's the problem.

PS: also just noticed that https://github.com/WebThingsIO/gateway/issues/2873 should be 12.

arist0v commented 2 years ago

I'm using tye zigbee addon for now, i wait to see the update, if you need me to test stuff just ask, i'll be glad to help

Le dim. 12 sept. 2021 17 h 33, Fabien Benetou @.***> a écrit :

I see that mqtt 4 deprecated node end of life versions, so 10 is out. Maybe that's the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kabbi/zigbee2mqtt-adapter/issues/41#issuecomment-917714394, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSPAAC33GJGLN3A4GG3PI3UBUMDTANCNFSM5DATLI2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Utopiah commented 2 years ago

Indeed the zigbee-adapter add-on does work. I recommend you check its mqtt optional feature in case some of your hardware is not fully supported as-in.

Pulling in @flatsiedatsie as this seeems serious. If the main platform the add-on is for, WebThings, is not compatible anymore might be important to check either a patch here or upstream.

arist0v commented 2 years ago

I got some more feature qith zigbee2mqtt(like having the time on my thermostat) but that's not a big deal

Le dim. 12 sept. 2021 18 h 10, Fabien Benetou @.***> a écrit :

Indeed the zigbee-adapter add-on does work. I recommend you check its mqtt optional feature in case some of your hardware is not fully supported as-in.

Pulling in @flatsiedatsie https://github.com/flatsiedatsie as this seeems serious. If the main platform the add-on is for, WebThings, is not compatible anymore might be important to check either a patch here or upstream.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kabbi/zigbee2mqtt-adapter/issues/41#issuecomment-917719455, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSPAAD2GIRVNNYXVTMUSR3UBUQOZANCNFSM5DATLI2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

TobiBu commented 2 years ago

Hi,

i have a similar issue which I have posted Here Including the error messages I found in the log file. Any idea how I may get the addon to work?

TobiBu commented 2 years ago

I checked and I also have node --version v10.23.0 and npm --version 7.24.0

Can I simply update nodejs to some more recent version? Or would this break some other stuff of the webthings image?

flatsiedatsie commented 2 years ago

I'm running into this too. I'm looking into it.

flatsiedatsie commented 2 years ago

I managed to fi the issue.

I first ran

npm install -g typescript

and then

npm i --save-dev @types/node

It could be that only the second part is needed.

TobiBu commented 2 years ago

Hi, thanks for the advice. I followed the two commands you suggested. but I still get the following error message in the logs: 2021-09-22 19:27:19.945 ERROR : zigbee2mqtt-adapter: (node:3812) UnhandledPromiseRejectionWarning: Error: Command failed: npm run build 2021-09-22 19:27:19.946 ERROR : zigbee2mqtt-adapter: 2021-09-22 19:27:19.947 ERROR : zigbee2mqtt-adapter: at ChildProcess.exithandler (child_process.js:294:12) 2021-09-22 19:27:19.948 ERROR : zigbee2mqtt-adapter: at ChildProcess.emit (events.js:198:13) 2021-09-22 19:27:19.950 ERROR : zigbee2mqtt-adapter: at maybeClose (internal/child_process.js:982:16) 2021-09-22 19:27:19.951 ERROR : zigbee2mqtt-adapter: at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 2021-09-22 19:27:19.954 ERROR : zigbee2mqtt-adapter: (node:3812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) 2021-09-22 19:27:19.956 ERROR : zigbee2mqtt-adapter: (node:3812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

even after rebooting the gateway.

flatsiedatsie commented 2 years ago

You have to run the commands from inside this directory:

cd /home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt

If you want to try, you can then build the zigbee2mqtt instance by running this command:

npm ci --production

and then this should work:

node ./index.js

A new version of the addon is on its way

TobiBu commented 2 years ago

Thanks for these suggestions. I tried them but it seems there is still an unhandled promise rejection. See terminal output below.

pi@gateway:~ $ cd /home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt pi@gateway:~/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt $ npm install -g typescript

changed 1 package, and audited 2 packages in 6s

found 0 vulnerabilities pi@gateway:~/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt $ npm i --save-dev @types/node npm WARN old lockfile npm WARN old lockfile The npm-shrinkwrap.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile

added 656 packages, and audited 967 packages in 1m

71 packages are looking for funding runnpm fundfor details

found 0 vulnerabilities pi@gateway:~/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt $ npm ci --production

added 310 packages, and audited 311 packages in 45s

8 packages are looking for funding runnpm fundfor details

found 0 vulnerabilities pi@gateway:~/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt $ node ./index.js Building Zigbee2MQTT... (initial build), failed (node:1676) UnhandledPromiseRejectionWarning: Error: Command failed: npm run build

at ChildProcess.exithandler (child_process.js:294:12) at ChildProcess.emit (events.js:198:13) at maybeClose (internal/child_process.js:982:16) at Socket.stream.socket.on (internal/child_process.js:389:11) at Socket.emit (events.js:198:13) at Pipe._handle.close (net.js:607:12) (node:1676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:1676) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. pi@gateway:~/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt $

TobiBu commented 2 years ago

Hi,

I saw zigbee2mqtt was updated, however, the issue still persists and I get this error messages now...

2021-10-05 17:45:55.939 INFO : zigbee2mqtt-adapter: ola running stdout: CREATED DECONZ ADAPTER 2021-10-05 17:45:55.941 INFO : zigbee2mqtt-adapter: 2021-10-05 17:45:55.962 INFO : zigbee2mqtt-adapter: ola running stdout: Zigbee2MQTT:error 2021-10-05 17:45:55: Error while starting zigbee-herdsman 2021-10-05 17:45:55.963 INFO : zigbee2mqtt-adapter: 2021-10-05 17:45:55.973 INFO : zigbee2mqtt-adapter: ola running stdout: Zigbee2MQTT:error 2021-10-05 17:45:55: Failed to start zigbee 2021-10-05 17:45:55.974 INFO : zigbee2mqtt-adapter: 2021-10-05 17:45:55.976 INFO : zigbee2mqtt-adapter: Yikes, failed to start Zigbee2MQTT. Try again later? 2021-10-05 17:45:56.010 INFO : zigbee2mqtt-adapter: pkill error: Error: Command failed: pkill 'zigbee2mqtt-adapter/zigbee2mqtt/index.js' 2021-10-05 17:45:56.012 INFO : zigbee2mqtt-adapter: ola running stdout: Zigbee2MQTT:error 2021-10-05 17:45:55: Check https://www.zigbee2mqtt.io/information/FAQ.html#help-zigbee2mqtt-fails-to-start for possible solutions 2021-10-05 17:45:56.013 INFO : zigbee2mqtt-adapter: Zigbee2MQTT:error 2021-10-05 17:45:55: Exiting... 2021-10-05 17:45:56.014 INFO : zigbee2mqtt-adapter: 2021-10-05 17:45:56.018 INFO : zigbee2mqtt-adapter: basic configuration.yaml file was succesfully created! 2021-10-05 17:45:56.095 INFO : zigbee2mqtt-adapter: ola running stdout: Zigbee2MQTT:error 2021-10-05 17:45:56: Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port' 2021-10-05 17:45:56.096 INFO : zigbee2mqtt-adapter: at SerialPort.serialPort.open (/home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:182:28) 2021-10-05 17:45:56.097 INFO : zigbee2mqtt-adapter: at SerialPort._error (/home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14) 2021-10-05 17:45:56.098 INFO : zigbee2mqtt-adapter: at binding.open.then.err (/home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12) 2021-10-05 17:45:56.100 INFO : zigbee2mqtt-adapter: 2021-10-05 17:45:56.116 INFO : zigbee2mqtt-adapter: ola closing code: 1

any news on this? thanks a lot

arist0v commented 2 years ago

sorry for the long delay, i just try to reinstall the addons, and i got this error now:

zigbee2mqtt-adapter: Error: Cannot find module 'core-js/features/object/from-entries'

longer log:

2021-11-01 20:36:53.438 INFO : zigbee2mqtt-adapter: basic configuration.yaml file was succesfully created! 2021-11-01 20:37:03.433 INFO : zigbee2mqtt-adapter: attempting to latch onto MQTT 2021-11-01 20:37:04.076 INFO : zigbee2mqtt-adapter: ola stderr: internal/modules/cjs/loader.js:638 2021-11-01 20:37:04.080 INFO : zigbee2mqtt-adapter: throw err; 2021-11-01 20:37:04.084 INFO : zigbee2mqtt-adapter: ^ 2021-11-01 20:37:04.087 INFO : zigbee2mqtt-adapter: 2021-11-01 20:37:04.090 INFO : zigbee2mqtt-adapter: Error: Cannot find module 'core-js/features/object/from-entries' 2021-11-01 20:37:04.092 INFO : zigbee2mqtt-adapter: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) 2021-11-01 20:37:04.093 INFO : zigbee2mqtt-adapter: at Function.Module._load (internal/modules/cjs/loader.js:562:25) 2021-11-01 20:37:04.098 INFO : zigbee2mqtt-adapter: at Module.require (internal/modules/cjs/loader.js:692:17) 2021-11-01 20:37:04.101 INFO : zigbee2mqtt-adapter: at require (internal/modules/cjs/helpers.js:25:18) 2021-11-01 20:37:04.104 INFO : zigbee2mqtt-adapter: at Object. (/home/pi/.webthings/data/zigbee2mqtt-adapter/zigbee2mqtt/index.js:1:1) 2021-11-01 20:37:04.107 INFO : zigbee2mqtt-adapter: at Module._compile (internal/modules/cjs/loader.js:778:30) 2021-11-01 20:37:04.110 INFO : zigbee2mqtt-adapter: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) 2021-11-01 20:37:04.113 INFO : zigbee2mqtt-adapter: at Module.load (internal/modules/cjs/loader.js:653:32) 2021-11-01 20:37:04.116 INFO : zigbee2mqtt-adapter: at tryModuleLoad (internal/modules/cjs/loader.js:593:12) 2021-11-01 20:37:04.119 INFO : zigbee2mqtt-adapter: at Function.Module._load (internal/modules/cjs/loader.js:585:3) 2021-11-01 20:37:04.122 INFO : zigbee2mqtt-adapter: 2021-11-01 20:37:04.125 INFO : zigbee2mqtt-adapter: ola closing code: 1 2021-11-01 20:37:44.862 INFO : Pairing timeout

flatsiedatsie commented 2 years ago

What kind of system are you running? Is this a Raspberry Pi with the provided gateway 1.0.0 image? That missing Node module is a bit strange.

arist0v commented 2 years ago

Yes raspberry pi with provided image

Le mer. 1 déc. 2021, 05 h 08, flatsiedatsie @.***> a écrit :

What kind of system are you running? Is this a Raspberry Pi with the provided gateway 1.0.0 image? That missing Node module is a bit strange.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kabbi/zigbee2mqtt-adapter/issues/41#issuecomment-983484434, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSPAAHYBJES654EFY6FDYLUOXXYRANCNFSM5DATLI2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ben-digitalhive commented 2 years ago

Can confirm the other issue I raised is on a brand new 1.0 RPI build

flatsiedatsie commented 2 years ago

I just did a test with a Raspberry Pi 3 and a fresh image of Gateway 1.0.0, and a freshly flashed CC2251 Zigbee stick.

It installed fine.

Very strange. There clearly is an issue, but I can't seem to reproduce it.

Could it be that the installation process was interupted? After adding the addon it takes an additional 30 minutes for Zigbee2MQTT to be fully installed.

Could you try uninstalling the addon and then running this command via the Seashell addon? It will remove any lingering settings, and will force zigbee2mqtt to be reinstalled.

rm -rf ~/.webthings/data/zigbee2mqtt-adapter

Then reboot.

Also, keep the 'auto-update' feature disabled.

flatsiedatsie commented 2 years ago

@TobiBu your error indicates something else is already using the USB stick. Make sure you uninstall the other Zigbee addon.

You could install a newer version of node, but it's quite a hassle (you will need to update the gateway itself too, and addons might need a reinstall too, etc), and it shouldn't be necessary.

TobiBu commented 2 years ago

@flatsiedatsie thanks a lot for your answer. It seems that solves the issue. Didn't know I had to uninstall the other add-on. might be worth pointing out somewhere in the notes.

arist0v commented 2 years ago

on my side it's now working so i close this