Installer Zigbee2MQTT sur RaspberryPI

# Lancer le scrypt d'installation dans le terminal linux de votre RaspberryPI
sudo curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs git make g++ gcc mosquitto
sudo mkdir /opt/zigbee2mqtt
sudo chown -R ${USER}: /opt/zigbee2mqtt
git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
npm ci
npm run build
mv /opt/zigbee2mqtt/data/configuration.yaml /opt/zigbee2mqtt/data/configuration.yaml.old


# Editer le fichier de config
nano /opt/zigbee2mqtt/data/configuration.yaml

# Copiez y le contenu suivant, en raplacent "VOTRE_PORT"
# par votre configuration (port serie du dongle Zigbee),
# ainsi que "VOTRE_PASS" par le mot de passe de votre choix.

mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost'
serial:
  port: /dev/ttyVOTRE_PORT
frontend:
  port: 8090
  auth_token: 'VOTRE_PASS'
advanced:
  network_key: GENERATE
  pan_id: GENERATE


# Pour lancer Zigbee2MQTT au démarage, éditez le fichier suivant :
sudo nano /etc/systemd/system/zigbee2mqtt.service

# Copiez ceci dans le fichier en personnalisant "VOTRE_USER" :
[Unit]
Description=zigbee2mqtt
After=network.target

[Service]
Environment=NODE_ENV=production
ExecStart=/usr/bin/npm start
WorkingDirectory=/opt/zigbee2mqtt
StandardOutput=inherit
systemd.exec(5)
StandardError=inherit
Restart=always
RestartSec=10s
User=VOTRE_USER

[Install]
WantedBy=multi-user.target


# Activez le service
sudo systemctl enable zigbee2mqtt.service

# Redémarrez, c'est terminé !
sudo reboot


Par Nicolas, Le 17 décembre 2023

A propos | domotique-libre.fr | 2025