howto patched

This commit is contained in:
2026-08-20 17:50:59 +02:00
parent 9f6131c643
commit b4405bac25
+135 -7
View File
@@ -24,7 +24,7 @@ ls -l /dev/serial/by-id/
You should see a persistent device path similar to:
```text
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_...
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_2281293efa9aef1190f1b69061ce3355-if00-port0 -> ../../ttyUSB0
```
Use this `/dev/serial/by-id/...` path instead of `/dev/ttyUSB0` or
@@ -35,7 +35,7 @@ Check the label on the dongle to determine its adapter type:
| Dongle model | Zigbee2MQTT adapter type |
| --- | --- |
| `ZBDongle-P` | `zstack` |
| `ZBDongle-E` | `ember` |
The two dongles have similar names but contain different radio chips.
@@ -43,7 +43,7 @@ References:
- [Zigbee2MQTT adapter configuration](https://www.zigbee2mqtt.io/guide/configuration/adapter-settings.html)
- [ZBDongle-P documentation](https://www.zigbee2mqtt.io/guide/adapters/zstack.html)
- [ZBDongle-E documentation](https://www.zigbee2mqtt.io/guide/adapters/emberznet.html)
## 2. Install the Mosquitto MQTT broker
@@ -56,13 +56,130 @@ sudo systemctl enable --now mosquitto
systemctl status mosquitto --no-pager
```
```bash
sudo tee /etc/mosquitto/conf.d/zigbee2mqtt.conf >/dev/null <<'EOF'
listener 1883 192.168.178.56
allow_anonymous true
EOF
```
and restart the service
For an initial setup confined to the Pi and a trusted LAN, the local broker is
sufficient. Configure authentication before exposing MQTT outside your trusted
network.
Reference: [Mosquitto downloads](https://mosquitto.org/download/)
## 3. Run Zigbee2MQTT with Docker
## 3. Install Docker and Docker Compose
Identify the operating system and architecture first:
```bash
grep -E '^(ID|VERSION_CODENAME)=' /etc/os-release
dpkg --print-architecture
```
On a Raspberry Pi 5, the architecture should normally be `arm64`. Select the
repository below that matches the reported `ID`. Do not combine an Ubuntu
codename such as `noble` with the Debian repository.
Install the prerequisites:
```bash
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
```
### Ubuntu (`ID=ubuntu`, including `VERSION_CODENAME=noble`)
If an earlier attempt installed the wrong Debian source, replace it with
Docker's Ubuntu source:
```bash
sudo rm -f /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.sources
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt-get update
```
For Ubuntu 24.04, that correctly uses the Ubuntu repository and `noble` suite.
### Raspberry Pi OS or Debian (`ID=raspbian` or `ID=debian`)
Add Docker's Debian source:
```bash
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt-get update
```
Install Docker Engine and the Compose plugin:
```bash
sudo apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
```
Enable Docker at boot and verify the installation:
```bash
sudo systemctl enable --now docker
sudo docker run --rm hello-world
sudo docker version
sudo docker compose version
```
Docker Compose is now invoked as `docker compose`. The old `docker-compose`
command is the legacy standalone version and is not needed.
### Optional: run Docker without `sudo`
Add your current account to the `docker` group:
```bash
sudo usermod -aG docker "$USER"
```
Then log out and back in, or reboot:
```bash
sudo reboot
```
After reconnecting, verify that it works without `sudo`:
```bash
docker run --rm hello-world
docker compose version
```
Membership of the `docker` group effectively gives the account root-level
control of the machine. Only add trusted users.
If `dpkg --print-architecture` reports `armhf`, you are using a 32-bit OS. A
64-bit Raspberry Pi OS or Ubuntu installation is recommended on the Pi 5.
References:
- [Install Docker Engine on Debian](https://docs.docker.com/engine/install/debian/)
- [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/)
- [Install Docker Engine on 32-bit Raspberry Pi OS](https://docs.docker.com/engine/install/raspberry-pi-os/)
- [Install the Docker Compose plugin](https://docs.docker.com/compose/install/linux/)
## 4. Run Zigbee2MQTT with Docker
Zigbee2MQTT recommends Docker because it avoids most Node.js and dependency
setup problems. Its image supports the Raspberry Pi's ARM architecture.
@@ -132,12 +249,24 @@ Adapter:
If `172.17.0.1` does not reach Mosquitto, use the Raspberry Pi's LAN IP
instead. Zigbee2MQTT may detect the adapter automatically.
```bash
vi "$HOME/zigbee2mqtt/data/configuration.yaml
frontend:
enabled: true
```
restart the container:
```bash
sudo docker compose restart zigbee2mqtt
sudo docker compose logs -f zigbee2mqtt
```
References:
- [Official Zigbee2MQTT Docker installation](https://www.zigbee2mqtt.io/guide/installation/02_docker.html)
- [Zigbee2MQTT onboarding](https://www.zigbee2mqtt.io/guide/getting-started/)
## 4. Pair the SNZB-02P sensor
## 5. Pair the SNZB-02P sensor
In the Zigbee2MQTT web interface:
@@ -155,7 +284,7 @@ SNZB-02P uses a CR2477 battery.
Reference: [SNZB-02P device support](https://www.zigbee2mqtt.io/devices/SNZB-02P.html)
## 5. Read the temperature
## 6. Read the temperature
Listen for sensor updates on the Raspberry Pi:
@@ -195,4 +324,3 @@ change, rather than continuously. The SNZB-02P publishes `temperature` in °C
and `humidity` as a percentage.
Reference: [Zigbee2MQTT MQTT topics](https://www.zigbee2mqtt.io/guide/usage/mqtt_topics_and_messages.html)