Skip to content

Instantly share code, notes, and snippets.

@paalbra
Last active January 6, 2025 15:56
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.py -ewv -p /dev/ttyUSB0 ./CC2652R_coordinator_20240710.hex

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