Install Zigbee2MQTT for Home Assistant on Arch Linux
Prerequisites:
- Arch Linux or an Arch-based distribution.
- A Zigbee coordinator (like a CC2531, Conbee II, or Sonoff Zigbee Dongle).
- Node.js and NPM (since Zigbee2MQTT is written in JavaScript).
Step-by-Step Installation:
1. Install Node.js and npm
First, make sure Node.js and npm (Node Package Manager) are installed:
sudo pacman -S nodejs npm
Verify the installation:
node -v npm -v
2. Install Mosquitto MQTT Broker
You need an MQTT broker (like Mosquitto) for communication between Zigbee2MQTT and Home Assistant.
sudo pacman -S mosquitto
Start and enable Mosquitto to run at boot:
sudo systemctl enable mosquitto sudo systemctl start mosquitto
3. Download Zigbee2MQTT
Clone the Zigbee2MQTT repository from GitHub:
git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
Change directory to Zigbee2MQTT:
cd /opt/zigbee2mqtt
4. Install Zigbee2MQTT dependencies
Install the required dependencies using npm:
npm ci
5. Configure Zigbee2MQTT
Before starting, you need to configure Zigbee2MQTT.
- Navigate to the configuration file:
nano /opt/zigbee2mqtt/data/configuration.yaml
- Set the MQTT broker details, and define your Zigbee device path (e.g., /dev/ttyACM0 for USB devices). Example configuration:
homeassistant: true permit_join: true mqtt: base_topic: zigbee2mqtt server: 'mqtt://localhost' serial: port: /dev/ttyACM0
6. Start Zigbee2MQTT
- Now that it’s configured, you can start Zigbee2MQTT manually:
npm start
7. Run Zigbee2MQTT as a Service (Optional)
To ensure Zigbee2MQTT starts automatically on boot, you can create a systemd service:
- Create the service file:
sudo nano /etc/systemd/system/zigbee2mqtt.service
- Add the following content to the file:
[Unit] Description=Zigbee2MQTT After=network.target [Service] ExecStart=/usr/bin/npm start --prefix /opt/zigbee2mqtt WorkingDirectory=/opt/zigbee2mqtt StandardOutput=inherit StandardError=inherit Restart=always User=root [Install] WantedBy=multi-user.target
- Reload systemd to recognize the new service:
sudo systemctl daemon-reload
- Enable and start Zigbee2MQTT:
sudo systemctl enable zigbee2mqtt sudo systemctl start zigbee2mqtt
8. Access Zigbee2MQTT Frontend
By default, Zigbee2MQTT runs a web interface at http://localhost:8080 (or replace localhost with your server’s IP). You can enable it in the configuration.yaml:
yaml:
frontend: port: 8080
Now you can start using Zigbee2MQTT with Home Assistant or any other platform via the MQTT broker.