{"id":8565,"date":"2024-09-26T16:47:41","date_gmt":"2024-09-26T14:47:41","guid":{"rendered":"https:\/\/shakti.tattva.se\/?p=8565"},"modified":"2024-09-26T16:47:41","modified_gmt":"2024-09-26T14:47:41","slug":"install-zigbee2mqtt-for-home-assistant-on-arch-linux","status":"publish","type":"post","link":"https:\/\/shakti.tattva.se\/index.php\/install-zigbee2mqtt-for-home-assistant-on-arch-linux\/","title":{"rendered":"Install Zigbee2MQTT for Home Assistant on Arch Linux"},"content":{"rendered":"<h5><span style=\"font-size: 18pt;\">Prerequisites:<\/span><\/h5>\n<ol>\n<li>Arch Linux or an Arch-based distribution.<\/li>\n<li>A Zigbee coordinator (like a CC2531, Conbee II, or Sonoff Zigbee Dongle).<\/li>\n<li>Node.js and NPM (since Zigbee2MQTT is written in JavaScript).<\/li>\n<\/ol>\n<h5>Step-by-Step Installation:<\/h5>\n<p>1. Install Node.js and npm<\/p>\n<p>First, make sure Node.js and npm (Node Package Manager) are installed:<\/p>\n<pre>sudo pacman -S nodejs npm<\/pre>\n<p>Verify the installation:<\/p>\n<pre>node -v\r\nnpm -v<\/pre>\n<h5>2. Install Mosquitto MQTT Broker<\/h5>\n<p>You need an MQTT broker (like Mosquitto) for communication between Zigbee2MQTT and Home Assistant.<\/p>\n<pre>sudo pacman -S mosquitto<\/pre>\n<p>Start and enable Mosquitto to run at boot:<\/p>\n<pre>sudo systemctl enable mosquitto\r\nsudo systemctl start mosquitto<\/pre>\n<h5>3. Download Zigbee2MQTT<\/h5>\n<p>Clone the Zigbee2MQTT repository from GitHub:<\/p>\n<pre>git clone https:\/\/github.com\/Koenkk\/zigbee2mqtt.git \/opt\/zigbee2mqtt<\/pre>\n<p>Change directory to Zigbee2MQTT:<\/p>\n<pre>cd \/opt\/zigbee2mqtt<\/pre>\n<h5>4. Install Zigbee2MQTT dependencies<\/h5>\n<p>Install the required dependencies using npm:<\/p>\n<pre>npm ci<\/pre>\n<h5>5. Configure Zigbee2MQTT<\/h5>\n<p>Before starting, you need to configure Zigbee2MQTT.<\/p>\n<ul>\n<li>Navigate to the configuration file:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">nano \/opt\/zigbee2mqtt\/data\/configuration.yaml<\/pre>\n<ul>\n<li>Set the <strong>MQTT broker<\/strong> details, and define your <strong>Zigbee device path<\/strong> (e.g., \/dev\/ttyACM0 for USB devices). Example configuration:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">homeassistant: true\r\npermit_join: true\r\nmqtt:\r\nbase_topic: zigbee2mqtt\r\nserver: 'mqtt:\/\/localhost'\r\nserial:\r\nport: \/dev\/ttyACM0<\/pre>\n<h5>6. Start Zigbee2MQTT<\/h5>\n<ul>\n<li>Now that it\u2019s configured, you can start Zigbee2MQTT manually:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">npm start<\/pre>\n<h5>7. Run Zigbee2MQTT as a Service (Optional)<\/h5>\n<p>To ensure Zigbee2MQTT starts automatically on boot, you can create a systemd service:<\/p>\n<ul>\n<li>Create the service file:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">sudo nano \/etc\/systemd\/system\/zigbee2mqtt.service<\/pre>\n<ul>\n<li>Add the following content to the file:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">[Unit]\r\nDescription=Zigbee2MQTT\r\nAfter=network.target\r\n\r\n[Service]\r\nExecStart=\/usr\/bin\/npm start --prefix \/opt\/zigbee2mqtt\r\nWorkingDirectory=\/opt\/zigbee2mqtt\r\nStandardOutput=inherit\r\nStandardError=inherit\r\nRestart=always\r\nUser=root\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\n<ul>\n<li>Reload systemd to recognize the new service:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">sudo systemctl daemon-reload<\/pre>\n<ul>\n<li>Enable and start Zigbee2MQTT:<\/li>\n<\/ul>\n<pre style=\"padding-left: 40px;\">sudo systemctl enable zigbee2mqtt\r\nsudo systemctl start zigbee2mqtt<\/pre>\n<h5>8. Access Zigbee2MQTT Frontend<\/h5>\n<p>By default, Zigbee2MQTT runs a web interface at http:\/\/localhost:8080 (or replace localhost with your server\u2019s IP). You can enable it in the configuration.yaml:<\/p>\n<p>yaml:<\/p>\n<pre style=\"padding-left: 40px;\">frontend:\r\nport: 8080<\/pre>\n<p>Now you can start using Zigbee2MQTT with Home Assistant or any other platform via the MQTT broker.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wprm-recipe-roundup-name":"","wprm-recipe-roundup-description":"","_kad_post_transparent":"default","_kad_post_title":"default","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"default","_kad_post_vertical_padding":"default","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8565","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/posts\/8565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/comments?post=8565"}],"version-history":[{"count":1,"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/posts\/8565\/revisions"}],"predecessor-version":[{"id":8566,"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/posts\/8565\/revisions\/8566"}],"wp:attachment":[{"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/media?parent=8565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/categories?post=8565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shakti.tattva.se\/index.php\/wp-json\/wp\/v2\/tags?post=8565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}