Summary
- Zigbee2MQTT enables Zigbee devices to communicate with your home automation software via MQTT.
- Utilizing a Raspberry Pi as a dedicated Zigbee hub provides flexibility in device placement.
- Running Zigbee2MQTT on a separate machine ensures network stability when restarting Home Assistant.
Smart home devices use many different methods to communicate. Some devices use Wi-Fi, others use Bluetooth, and some use Matter or Z-wave. A lot of smart home devices use Zigbee.
Zigbee has several benefits that make it a good fit for smart home devices. First off, it’s low power, so you can run many Zigbee devices from batteries. Secondly, it uses mesh networking, with each device able to pass on information to other devices in the mesh. This means that even if a device is far away from the Zigbee hub, it can pass its data through the mesh.
Related
8 reasons why a Raspberry Pi is perfect for tinkerers
The cheap single-board computer is a perfect tool for hobbyists.
In order to use Zigbee devices, however, you need a hub that supports Zigbee, such as some Amazon Echo devices. If you run a Home Assistant server, you can use a Zigbee dongle and software such as Zigbee2MQTT to connect Home Assistant to hundreds of different Zigbee devices. However, there are some good reasons why you might want to create a dedicated Zigbee hub using a Raspberry Pi.

Raspberry Pi 5
The Raspberry Pi 5 is a powerful single-board computer (SBC) that launched towards the end of 2023. It’s great for DIY tech projects or even as a low-power desktop PC.
What is Zigbee2MQTT, and why do you need it?
Let your Zigbee devices talk to your home automation software
Zigbee2MQTT is open-source software that works as a bridge between your Zigbee devices and an MQTT broker. It takes information from your Zigbee smart home devices and passes these messages on using the MQTT messaging protocol. Software such as Home Assistant can then access this MQTT data, which lets you integrate your Zigbee devices into your smart home automations.
The best part is that you can connect devices that otherwise need a proprietary hub.
Smart home hubs such as the Hue Bridge take the Zigbee signals from smart bulbs and pass the data to the Hue app so that you can control your lights. You can use Zigbee2MQTT to create your own smart home hub that will pass data from your Zigbee devices to your smart home software of choice.
The best part is that you can connect devices that otherwise need a proprietary hub. For example, you can add Philips Hue bulbs to your smart home without needing the Hue bridge or add IKEA smart home devices without needing IKEA’s smart hub.

Related
Best smart home hub: One device to rule them all
These smart home hubs make home automation even simpler.
What you’ll need to turn your Raspberry Pi into a Zigbee hub
You’ll need a Zigbee dongle to talk to your devices
There are really only two things that you need to turn your Pi into a Zigbee hub. First, you’ll need a Raspberry Pi to run the software on. You should be able to run it on most models; I’m using a Raspberry Pi 3B+, and it runs without any problems.
Second, you’ll need a Zigbee adapter. The Raspberry Pi doesn’t have native Zigbee support, so you’ll need a Zigbee dongle in order for your Pi to talk to your Zigbee devices. A list of compatible devices is available in the official Zigbee2MQTT guide.
Since Zigbee devices send a lot of data, you might also want to run Zigbee2MQTT on something other than an SD card. Reading and writing too much data to an SD card can cause it to fail — I personally use an SSD connected by USB instead.
You’ll also need to be running an MQTT broker. This acts as the intermediary between your devices and your software, sending and receiving MQTT messages. You can run an MQTT broker as an add-on in Home Assistant.

Related
Every Raspberry Pi model ranked from worst to best
Find out which SBC comes out with the biggest piece of the Pi.
Installing Raspberry Pi OS on your Pi
You’ll need an OS to get your Pi up and running
Zigbee2MQTT can run on Linux, Windows, Docker, and more. In this example, I’m running it on Raspberry Pi OS, which is the official distribution for the Raspberry Pi, but you can use alternatives if you want.
- Download the Raspberry Pi Imager software, and connect your storage device to your computer.
- Select your model of Raspberry Pi.
- Choose the Raspberry Pi OS software for your device.
- Select your storage device.
- Click Next.
- Select Edit Settings.
- Enter a hostname for your Raspberry Pi if you want.
- Enter the username and password you will use to remotely access your Pi.
- Enter the SSID and password for your Wi-Fi to access the internet wirelessly.
- Under the Services tab, check Enable SSH to allow you to access your Raspberry Pi via SSH.
- Close the settings and click Yes.
- Confirm you want to overwrite your storage device.
- Wait for the Raspberry Pi OS to be written to your storage device.
- When it’s finished, remove your storage device, connect it to your Raspberry Pi, and start it up.

Related
What is Linux? Everything you’ve always wanted to know
Linux is a powerful operating system with much to offer – find out what it is and how to get started.
Installing Zigbee2MQTT on your Raspberry Pi
Getting the software onto your Pi is a little complicated
Once Raspberry Pi OS is installed, you should be able to access your Raspberry Pi remotely from a computer. You can then install Zigbee2MQTT directly onto your Raspberry Pi.
- SSH into your Raspberry Pi by entering the following in PowerShell on Windows or Terminal on Mac:
ssh [your_username]@[your_hostname].local
- Enter your password.
- Enter the following commands to install Node.js and the necessary dependencies:
sudo curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs git make g++ gcc libsystemd-dev
npm install -g pnpm
- To create a directory for Zigbee2MQTT, enter the following:
sudo mkdir /opt/zigbee2mqtt
- Set yourself as owner of the directory by entering the following and replacing [your_username] with the username you set up for Rasbperry Pi OS:
sudo chown -R [your_username]: /opt/zigbee2mqtt
- Clone the Zigbee2MQTT repository by entering the following:
git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
- Install the required dependencies by entering the following:
cd /opt/zigbee2mqtt
pnpm i --frozen-lockfile
- Finally, build Zigbee2MQTT by entering the following:
pnpm run build
Configuring Zigbee2MQTT on your Raspberry Pi
You need to point Zigbee2MQTT at your MQTT broker
Once Zigbee2MQTT has been installed, you’ll need to configure it to connect to your MQTT broker.
- Copy the default configuration file using the following commands:
cp /opt/zigbee2mqtt/data/configuration.example.yaml /opt/zigbee2mqtt/data/configuration.yaml
nano /opt/zigbee2mqtt/data/configuration.yam
- In the configuration file, set server to the IP address of your server. For example:
server: mqtt://192.168.1.6:1883
- To allow devices to be discovered by Home Assistant, under homeassistant, set enabled to true.
- Press Ctrl+X to exit.
- Type Y to confirm that you want to save the changes.
- Press Enter to save the changes.
- You’re now ready to start Zigbee2MQTT. Make sure that your Zigbee dongle is connected to your Raspberry Pi, and type the following:
cd /opt/zigbee2mqtt
pnpm start
- Zigbee2MQTT should now start. You can stop it at any time by pressing Ctrl+C.

Related
How I made all my smart home devices HomeKit compatible with a Raspberry Pi
Run Homebridge on your Raspberry Pi to connect incompatible devices.
Discovering devices using Zigbee2MQTT
Turn on discovery and pair your Zigbee tech
Now that Zigbee2MQTT is running, the final part is to add some devices to it. You’ll need to allow devices to join the network and then put the devices in pairing mode in order for them to join. By default, joining will open the network for 254 seconds and then turn it off.
- In a browser, navigate to your Raspberry Pi’s IP address followed by :8080. For example, I need to enter 192.168.1.6:8080.
- You should see the Zigbee2MQTT front end.
- Click the Permit Join (ALL) button.
- Your network will be temporarily available to join.
- To connect a device, put it into pairing mode. If Zigbee2MQTT supports your Zigbee device, you can find the method for putting it into pairing mode by searching the Supported Devices database.
- You should see the device appear in the Zigbee2MQTT front end. It may take some time for the device to be recognized and the information to populate.
- Repeat for any other devices you want to add.
You should now find that your devices have automatically been added to Home Assistant, along with all the available entities. You can now use the devices within Home Assistant however you see fit.

Related
Philips Hue complete system review: A shining light in the smart home
Smart lights are often the first foray into the smart home and Hue is often top of the list.
The benefits of running Zigbee2MQTT on a Raspberry Pi
You can place your Zigbee hub in the optimum location
It’s possible to run Zigbee2MQTT within Home Assistant as an add-on, and it’s much easier to install than following the steps above. However, installing Zigbee2MQTT on a Raspberry Pi offers some significant benefits.
The biggest benefit is that you’re not constrained by where your Zigbee hub is located.
The biggest benefit is that you’re not constrained by where your Zigbee hub is located. I used to run Zigbee2MQTT within Home Assistant, but my Home Assistant server is located next to my router, which is far from being central to my home. It meant that many of my Zigbee devices would drop off the network as they were too far away, even with other Zigbee devices in between extending the mesh network.
Now that Zigbee2MQTT is running on a Raspberry Pi, I can place it anywhere I want. It’s now located centrally in my home, and my Zigbee devices rarely drop off the network anymore.
You also don’t have to worry about Zigbee2MQTT going down every time you restart Home Assistant for any reason. Since it’s running on its own machine, your Zigbee network should stay up and running even if Home Assistant goes down.

Related
8 reasons why a Raspberry Pi is perfect for tinkerers
The cheap single-board computer is a perfect tool for hobbyists.
Trending Products

AULA Keyboard, T102 104 Keys Gaming Keyboard and Mouse Combo with RGB Backlit Quiet Laptop Keyboard, All-Steel Panel, Waterproof Gentle Up PC Keyboard, USB Wired Keyboard for MAC Xbox PC Players

Acer Aspire 3 A315-24P-R7VH Slim Laptop computer | 15.6″ Full HD IPS Show | AMD Ryzen 3 7320U Quad-Core Processor | AMD Radeon Graphics | 8GB LPDDR5 | 128GB NVMe SSD | Wi-Fi 6 | Home windows 11 Residence in S Mode

MATX PC Case, 6 ARGB Followers Pre-Put in, Sort-C Gaming PC Case, 360mm Radiator Help, Tempered Glass Entrance & Facet Panels, Mid Tower Black Micro ATX Laptop Case

Wireless Keyboard and Mouse Combo, Lovaky 2.4G Full-Sized Ergonomic Keyboard Mouse, 3 DPI Adjustable Cordless USB Keyboard and Mouse, Quiet Click for Computer/Laptop/Windows/Mac (1 Pack, Black)

Lenovo Newest 15.6″ Laptop, Intel Pentium 4-core Processor, 15.6″ FHD Anti-Glare Display, Ethernet Port, HDMI, USB-C, WiFi & Bluetooth, Webcam (Windows 11 Home, 40GB RAM | 1TB SSD)

ASUS RT-AX5400 Twin Band WiFi 6 Extendable Router, Lifetime Web Safety Included, Immediate Guard, Superior Parental Controls, Constructed-in VPN, AiMesh Appropriate, Gaming & Streaming, Sensible Dwelling

AOC 22B2HM2 22″ Full HD (1920 x 1080) 100Hz LED Monitor, Adaptive Sync, VGA x1, HDMI x1, Flicker-Free, Low Blue Mild, HDR Prepared, VESA, Tilt Modify, Earphone Out, Eco-Pleasant

Logitech MK540 Superior Wi-fi Keyboard and Mouse Combo for Home windows, 2.4 GHz Unifying USB-Receiver, Multimedia Hotkeys, 3-12 months Battery Life, for PC, Laptop computer
