Using zigbee2mqtt with Electrolama zig-a-zig-ah! (zzh!) (CC2652R1 - External Antenna).
- Plug in zzh
sudo dmesg --human | grep "attached to"
- Observe that it's attached to something like
ttyUSB0
, AKA/dev/ttyUSB0
Plug in device with BSL-button pressed. My experience is that 'cc2538-bsl.py' often fails to flash the stick. A theory is that it's related to a combination of USB-port and... luck? Retry with different computers/USB-ports if it fails.
ls -lh /dev/ttyUSB0 # observe dialout? Might want to: sudo usermod -aG dialout $USER
cd $(mktemp -d)
curl -sSL https://github.com/JelmerT/cc2538-bsl/archive/refs/heads/master.tar.gz | tar xz --strip 1 # Best experience from master
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC2652R_coordinator_20240710.zip # Or check for newer versions
unzip CC2652R_coordinator_20240710.zip
python3 -m venv venv
. venv/bin/activate
pip install pyserial intelhex
python ./cc2538_bsl/cc2538_bsl.py -ewv -p /dev/ttyUSB0 ./CC2652R_coordinator_20240710.hex
This should output something like:
Opening port /dev/ttyUSB0, baud 500000
Reading data from ./CC2652R_coordinator_20240710.hex
Your firmware looks like an Intel Hex file
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:11:22:33:44:55:66:77
Performing mass erase
Erasing all main bank flash sectors
Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F988
Write done
Verifying by comparing CRC32 calculations.
Verified (match: 0x27bed345)
Details: https://www.zigbee2mqtt.io/guide/adapters/flashing/flashing_via_cc2538-bsl.html
docker-compose.yml:
version: "3"
services:
mqtt:
image: "eclipse-mosquitto:2.0"
restart: "unless-stopped"
# volumes:
# - "./mosquitto-data:/mosquitto:Z"
ports:
- "1883:1883"
# - "9001:9001"
command: "/usr/sbin/mosquitto -c /mosquitto-no-auth.conf"
zigbee2mqtt:
image: "koenkk/zigbee2mqtt"
container_name: "zigbee2mqtt"
restart: "unless-stopped"
volumes:
- "./data:/app/data:Z"
# - "/run/udev:/run/udev:ro"
ports:
- "8080:8080"
environment:
- "TZ=Europe/Oslo"
devices:
- "/dev/ttyUSB0:/dev/ttyUSB0"
data/configuration.yaml:
# Let new devices join our zigbee network
permit_join: true
# Docker-Compose makes the MQTT-Server available using "mqtt" hostname
mqtt:
base_topic: zigbee2mqtt
server: mqtt://mqtt
# Zigbee Adapter path
serial:
port: /dev/ttyUSB0
adapter: zstack
# Enable the Zigbee2MQTT frontend
frontend:
enabled: true
port: 8080
# Enable Home Assistant integration
homeassistant:
enabled: true
# Let Zigbee2MQTT generate a new network key on first start
advanced:
network_key: GENERATE
Fedora:
sudo setsebool -P container_use_devices 1
podman-compose --podman-run-args '--group-add keep-groups' up -d # Beware of other SELinux issues that could depend on i.e. volume location.
Raspberry pi OS:
sudo usermod -aG docker $USER
docker-compose up -d