Context and Requirements
To capture and feed sensor data into Home Assistant, Zigbee is a popular and reliable choice. As a standard in the Smart Home ecosystem, Zigbee continues to grow in popularity, with many devices now supporting it out of the box. Examples include:
- IKEA Smart Home
- Tuya
- Philips Hue
For a comprehensive list of supported Zigbee devices (along with their attributes and specifications), refer to the Zigbee2MQTT database: https://www.zigbee2mqtt.io/supported-devices/#
Hardware Requirements
- Raspberry Pi 4
- ZBDongle-E (Zigbee USB coordinator)
Software Requirements
- Raspberry Pi Imager (https://www.raspberrypi.com/software/)
Official utility to install operating systems onto a Raspberry Pi with ease. - Home Assistant (https://www.home-assistant.io)
Open-source smart home platform focused on local control and privacy. - Eclipse Mosquitto (https://mosquitto.org)
A lightweight MQTT broker ideal for IoT and M2M communication. It uses a publish/subscribe model and supports features like TLS encryption and persistent messages. - Zigbee2MQTT (https://www.zigbee2mqtt.io)
A bridge that connects Zigbee devices to MQTT, removing the need for vendor-specific hubs and enabling seamless integration with Home Assistant and other platforms.
Installing Home Assistant
Step 1: Flash the Home Assistant Image to SD Card
Use Raspberry Pi Imager to write the Home Assistant OS image to an SD card:
- Launch Raspberry Pi Imager.
- Select your Raspberry Pi model and the Home Assistant OS image.
- Insert your SD card and flash the image.
Source: https://www.home-assistant.io/installation/raspberrypi/
Step 2: Boot and Set Up Home Assistant
- Insert the flashed SD card into the Raspberry Pi and power it on.
- Wait a few minutes for the initial setup.
- Access the Home Assistant UI via:
http://homeassistant.local:8123
(Note: This may vary depending on your network/DNS configuration.)
MQTT
MQTT (Message Queuing Telemetry Transport) is a lightweight, publish-subscribe messaging protocol ideal for M2M and IoT scenarios. It enables efficient, low-latency communication between devices through a central broker (e.g., Mosquitto).
Parts of these instructions are based on: https://github.com/zigbee2mqtt/hassio-zigbee2mqtt
Install MQTT Broker
Step 1: Install Mosquitto Broker
Install the Mosquitto broker via Home Assistant Add-ons:
- Go to Settings > Add-ons > Add-on Store.
- Search for and install Mosquitto Broker.
- Start the add-on and enable Start on boot.
Configuration Logins
- username: mqtt password: mqtt-password-123
Step 2: Enable MQTT Integration in Home Assistant
- Go to Settings > Devices & Services.
- Click Add Integration and choose MQTT.
- If Mosquitto is running correctly, it will be auto-discovered.
- Configure the credentials if prompted.
Install Zigbee2MQTT
Flashing the ZBDongle-E Firmware (If Required)
If you need to update your Zigbee dongle firmware, use the official tool. Note: Only works with Chrome-based browsers (Google Chrome, Microsoft Edge).
Link: https://darkxst.github.io/silabs-firmware-builder/
Retrieve Dongle ID via SSH
The dongle id is relevant for the following Zigbee2MQTT installation. Therefore, we add the dongle into the Raspberry Pi, install SSH and retrieve the dongle id.
Install Zigbee2MQTT
Zigbee2MQTT is not available in the default Home Assistant Add-on store. To install:
- Go to Settings > Add-ons > Add-on Store.
- Click the three-dot menu (top-right) > Repositories.
- Add the following repository URL:
https://github.com/zigbee2mqtt/hassio-zigbee2mqtt
- Search for Zigbee2MQTT and install it.
Configuration:
Section mqtt:
base_topic: zigbee2mqtt user: mqtt password: mqtt-password-123 server: mqtt://core-mosquitto:1883
Section serial:
Replace the dongle ID with the actual one.
port: >- /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_180f8e5692dbed118b0bed2d62c613ac-if00-port0 adapter: ember rtscts: false
Conclusion
With Home Assistant, Mosquitto, and Zigbee2MQTT properly configured, you now have a powerful local smart home setup. Zigbee devices communicate via MQTT, and Home Assistant handles automation, dashboards, and moreāall without relying on cloud services.