I’m running zigbee2mqtt on CC2531 (with antenna, forgot its model) and a Linux machine.
Sometimes zigbee2mqtt stops working and I have to change the ownership of the device (chown) to successfully run it again. So I put it in one script:
~/my_services/zigbee2mqtt_service $ cat z2m.sh
sudo chown gal /dev/ttyACM0
cd /opt/zigbee2mqtt
npm start
and created a service in systemd/systemctl for the script:
~/my_services/zigbee2mqtt_service $ systemctl cat zigbee2mqtt.service
# /etc/systemd/system/zigbee2mqtt.service
[Unit]
Description=zigbee2mqtt
After=network.target
[Service]
# ExecStart=/usr/local/bin/npm start
# WorkingDirectory=/opt/zigbee2mqtt
ExecStart=/home/gal/my_services/zigbee2mqtt_service/z2m.sh
StandardOutput=inherit
StandardError=inherit
Restart=always
User=gal
[Install]
WantedBy=multi-user.target
This used to work, but for some reason, it won’t run now. I’m tried enabling, starting manually, and reload daemon. If I run the z2m.sh script manually it works well, but I’m working from a remote machine so I have to disconnect, which stops zigbee2mqtt.
It’d be great if you can point me to what to fix, or to a different way to recover from the ‘revoked ownership’.