tteck / Proxmox

Proxmox VE Helper-Scripts
https://Helper-Scripts.com
MIT License
14.52k stars 2.4k forks source link

zigbee2mqtt installation issues (might be the mqtt broker) #132

Closed gdneye closed 2 years ago

gdneye commented 2 years ago

Hey man...

I really appreciate that you've put together these scripts. So far Ive been able to use them to set up a VM for HAOS and LXC containers for Unifi, Adguard and Dashy.

I've been trying to get mqtt and zigbee2mqtt set up and I've been losing my mind for the last 3 days trying to figure out what I'm doing wrong.

My setup is a sonoff 3.0 that I successfully flashed according to these instructions:

https://www.youtube.com/watch?v=4jqQCxjlRDU

And proxmox is running on a Deskmini with 32gb ram, a 250gb m2 ssd and a 5700g with the containers I described. Nothing else is running on that machine. My comprehension level of this stuff is probably pretty low compared to most ppl who use HA. I'm not a programmer, but I really enjoy messing around with stuff and I have done a lot of programming adjacent things previously. I can usually sort of brute force my way through not understanding things with Google, but I'm not coming back with very many results combining Proxmox and MQTT. At least not very many helpful ones.

Also, after failing for a while I briefly set up ZHA just to verify that it wasn't an issue with my Sonoff Dongle and to see if I could get the passthrough working (even though the passthrough is different for a VM). I was able to get ZHA set up in no time and add a few devices, so I'm confident my Sonoff Dongle is working properly.

I've followed the instructions you give. I have removed the LXC's and reinstalled at least a dozen times and trying to tweak various settings, so I don't believe it could be a faulty install either and at this point I am very familiar with the instructions, so I don't think I missed any steps.

I'll try to be specific with any question. If you're willing to help any I greatly appreciate it.

1) First, is there a way to test out that the MQTT broker is running? I have a Fixed IP for the MQTT LXC (both on my router and in the LCX) set at 192.168.1.203 and . I've tried going to 192.168.1.203:1883, mqtt://192.168.1.203:1883 (this just does a google search), and http://192.168.1.203:9442/.

I also think it is worth noting that even though the MQTT broker and Z2M containers are both running, neither of them is showing up on my router (although they have both shown up at least once in the past, because they do exist in my router, they just aren't online).

2) Moving on to Z2M, I get the following error when I try 'npm start'

Zigbee2MQTT:info 2022-04-07 23:57:20: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2022-04-07.23-57-20' filename: log.txt Zigbee2MQTT:info 2022-04-07 23:57:20: Starting Zigbee2MQTT version 1.25.0 (commit #6f1460e4) Zigbee2MQTT:info 2022-04-07 23:57:20: Starting zigbee-herdsman (0.14.20) Zigbee2MQTT:error 2022-04-07 23:57:20: Error while starting zigbee-herdsman Zigbee2MQTT:error 2022-04-07 23:57:20: Failed to start zigbee Zigbee2MQTT:error 2022-04-07 23:57:20: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions Zigbee2MQTT:error 2022-04-07 23:57:20: Exiting... Zigbee2MQTT:error 2022-04-07 23:57:20: Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port' at SerialPort. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28) at SerialPort._error (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14) at /opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zigbee2mqtt@1.25.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.25.0 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/2022-04-07T23_57_20_890Z-debug.log

And this is my config file. I've changed the pw bc that's what I've seen others do, but I'm certain the username and pw are the same as what I put into the MQTT LXC.

GNU nano 5.4 /opt/zigbee2mqtt/data/configuration.yaml
frontend: port: 9442 homeassistant: true permit_join: false mqtt: base_topic: zigbee2mqtt server: mqtt://192.168.1.203:1883 user: mqqt_user password: 123456 keepalive: 60 reject_unauthorized: true version: 4 serial: port: /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_30580edc0945ec118d9494fd6f14af06-if00-port0 advanced: pan_id: 4546 network_key:

Any help would be appreciated. I'm fairly certain I've followed your instructions exactly, so I don't know where to go from here.

Thanks, Tim

gdneye commented 2 years ago

Here is the output of the "complete log of this run"

0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ] 2 info using npm@6.14.16 3 info using node@v14.19.1 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle zigbee2mqtt@1.25.0~prestart: zigbee2mqtt@1.25.0 6 info lifecycle zigbee2mqtt@1.25.0~start: zigbee2mqtt@1.25.0 7 verbose lifecycle zigbee2mqtt@1.25.0~start: unsafe-perm in lifecycle true 8 verbose lifecycle zigbee2mqtt@1.25.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/zigbee2mqtt/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 9 verbose lifecycle zigbee2mqtt@1.25.0~start: CWD: /opt/zigbee2mqtt 10 silly lifecycle zigbee2mqtt@1.25.0~start: Args: [ '-c', 'node index.js' ] 11 silly lifecycle zigbee2mqtt@1.25.0~start: Returned: code: 1 signal: null 12 info lifecycle zigbee2mqtt@1.25.0~start: Failed to exec start script 13 verbose stack Error: zigbee2mqtt@1.25.0 start: node index.js 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:400:28) 13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:400:28) 13 verbose stack at maybeClose (internal/child_process.js:1058:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) 14 verbose pkgid zigbee2mqtt@1.25.0 15 verbose cwd /opt/zigbee2mqtt 16 verbose Linux 5.13.19-6-pve 17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start" 18 verbose node v14.19.1 19 verbose npm v6.14.16 20 error code ELIFECYCLE 21 error errno 1 22 error zigbee2mqtt@1.25.0 start: node index.js 22 error Exit status 1 23 error Failed at the zigbee2mqtt@1.25.0 start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

tteck commented 2 years ago

check and see if z2m is already running, IP:9442

gdneye commented 2 years ago

That would the the IP of the LXC where z2m is installed? If I use that IP I get the following message:

Firefox can’t establish a connection to the server at 192.168.1.252:9442.

tteck commented 2 years ago

It has started before, because it populated a pan_id and network_key moving to discussion