Good morning together,
I am (the noob) running dietpi on a raspberry pi 4 with pivpn, pihole, nextcloud, vaultwarden, mqtt and node red.
node. js and git are installed.
Bluetooth and wifi are not used or activated.
Next days i will receive a sonoff zigbee dongle and need some help by installation.
My questions are:
Must i activate serial/uart in dietpi config?
Both are deactivated. (ttyAMAO and ttySO)
Could someone please guide me through the installation of zigbee2mqtt?
Can i start with:
mkdir /opt/zigbee2mqtt
sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
sudo chown -R dietpi:dietpi /opt/zigbee2mqtt
cd /opt/zigbee2mqtt
npm ci
After the stick arrived, I installed it as indicated above.
However, now I get the following error message when starting.
dietpi@DietPi:~$ cd /opt/zigbee2mqtt
dietpi@DietPi:/opt/zigbee2mqtt$ npm start
> zigbee2mqtt@1.24.0 start
> node index.js
Zigbee2MQTT requires node version ^10 || ^12 || ^14 || ^15 || ^16, you are running v17.6.0!
Zigbee2MQTT:info 2022-03-24 15:24:03: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2022-03-24.15-24-02' filename: log.txt
Zigbee2MQTT:info 2022-03-24 15:24:03: Starting Zigbee2MQTT version 1.24.0 (commit #a73caa3e)
Zigbee2MQTT:info 2022-03-24 15:24:03: Starting zigbee-herdsman (0.14.20)
Zigbee2MQTT:error 2022-03-24 15:24:04: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-03-24 15:24:04: Failed to start zigbee
Zigbee2MQTT:error 2022-03-24 15:24:04: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-03-24 15:24:04: Exiting...
Zigbee2MQTT:error 2022-03-24 15:24:04: Error: Error while opening serialport 'Error: Error: Permission denied, cannot open /dev/ttyUSB0'
at SerialPort.<anonymous> (/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 notice
npm notice New patch version of npm available! 8.5.1 -> 8.5.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.5
npm notice Run npm install -g npm@8.5.5 to update!
npm notice
As far as I understand it is probably because of the write permissions.
After i add user dietpi to groups tty and dialout it works!
sudo usermod -a -G tty dietpi
sudo usermod -a -G dialout dietpi
But only i start manual.
I have the following /etc/systemd/system/zigbee2mqtt.service
[Unit]
Description=zigbee2mqtt
After=network.target
[Service]
ExecStart=/opt/zigbee2mqtt/npm start
WorkingDirectory=/opt/zigbee2mqtt
# StandardOutput=inherit
# Or use StandardOutput=null if you don't want Zigbee2MQTT messages filling syslog, for more option>
StandardOutput=null
StandardError=inherit
Restart=always
User=dietpi
[Install]
WantedBy=multi-user.target
and then
sudo systemctl enable zigbee2mqtt.service
but i get
sudo systemctl status zigbee2mqtt.service
● zigbee2mqtt.service - zigbee2mqtt
Loaded: loaded (/etc/systemd/system/zigbee2mqtt.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2022-03-24 18:08:34 CET; 52s ago
Process: 18255 ExecStart=/opt/zigbee2mqtt/npm start (code=exited, status=203/EXEC)
Main PID: 18255 (code=exited, status=203/EXEC)
CPU: 8ms
Mär 24 18:08:34 DietPi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 5.
Mär 24 18:08:34 DietPi systemd[1]: Stopped zigbee2mqtt.
Mär 24 18:08:34 DietPi systemd[1]: zigbee2mqtt.service: Start request repeated too quickly.
Mär 24 18:08:34 DietPi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.
Mär 24 18:08:34 DietPi systemd[1]: Failed to start zigbee2mqtt.
Unfortunately, I only have rudimentary knowledge of Linux.
I would be very grateful for some help.