paxswill / iocage-zigbee2mqtt

iocage plugin for Zigbee2MQTT
4 stars 3 forks source link

zigbee-herdsman wrong port issue on npm start #1

Closed GitIgnoreMaybe closed 3 years ago

GitIgnoreMaybe commented 3 years ago

Hey,

Thank you for the plugin. It definitely saves a lot of time. Currently, I'm facing an issue starting the service.

Even though I changed the config here: /opt/zigbee2mqtt/data/configuration.yaml to port: /dev/cuaU1

zigbee-herdsman seems not to find the CC2531. I checked out this one 👉 help-zigbee2mqtt-fails-to-start

`root@zigbee2mqtt:/opt/zigbee2mqtt # npm start

zigbee2mqtt@1.17.0 start /opt/zigbee2mqtt node index.js

Zigbee2MQTT:info 2021-01-30 17:27:52: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2021-01-30.17-27-52' filename: log.txt Zigbee2MQTT:info 2021-01-30 17:27:52: Starting Zigbee2MQTT version 1.17.0 (commit #435a64a) Zigbee2MQTT:info 2021-01-30 17:27:52: Starting zigbee-herdsman (0.13.46) Zigbee2MQTT:error 2021-01-30 17:27:52: Error while starting zigbee-herdsman Zigbee2MQTT:error 2021-01-30 17:27:52: Failed to start zigbee Zigbee2MQTT:error 2021-01-30 17:27:52: Exiting... Zigbee2MQTT:error 2021-01-30 17:27:52: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyACM0' at Znp. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:136:32) at Generator.next () at /opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:27:71 at new Promise () at __awaiter (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:23:12) at SerialPort. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:134:49) 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.17.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.17.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/2021-01-30T16_27_52_712Z-debug.log`

paxswill commented 3 years ago

The FreeBSD daemon is using a different data directory (/usr/local/etc/zigbee2mqtt), and the config file it's using is in there, not /opt/zigbee2mqtt/data.

When you're logged in to the shell of the jail, you can start/stop/check the daemon using the service utility (so service zigbee2mqtt FOO where FOO is one of start, stop, status, restart). The daemon will also log to /var/log/zigbee2mqtt_daemon.log, so following that log can be useful (tip: the log has color control codes embedded at the moment, so doing less -R /var/log/zigbee2mqtt_daemon.log will display them nicely. Then typing +F while in less will have it follow the end of the log, showing new entries as they appear).

If you want to run the service without a daemon (for quicker testing, logging to the console, etc), the command it's running should be equivalent to:

ZIGBEE2MQTT_DATA=/usr/local/etc/zigbee2mqtt /usr/local/bin/node /opt/zigbee2mqtt/cli.js
GitIgnoreMaybe commented 3 years ago

@paxswill Thanks a lot. The tip with less -R /var/log/zigbee2mqtt_daemon.log was super helpful. Seems like my MQTT broker setup in combination with my port was the issue. My fix was to point to the IP of the broker and to start the service.

Maybe something for the readme? I assume most of the folks will use the mosquitto broker and need to start the service after changing the config. Otherwise, the service will be not up out of the box.