Skip to content

Instantly share code, notes, and snippets.

@paalbra
Last active June 24, 2025 21:54
Show Gist options
  • Save paalbra/201e1c3e653051718cb6bae43b23c6a0 to your computer and use it in GitHub Desktop.
Save paalbra/201e1c3e653051718cb6bae43b23c6a0 to your computer and use it in GitHub Desktop.
Electrolama zzh

About

Using zigbee2mqtt with Electrolama zig-a-zig-ah! (zzh!) (CC2652R1 - External Antenna).

Find device

  1. Plug in zzh
  2. sudo dmesg --human | grep "attached to"
  3. Observe that it's attached to something like ttyUSB0, AKA /dev/ttyUSB0

Flashing

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

Running

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment