Update firmware on Sonoff Zigbee stick with a k8s batch
Figured I should update the firmware on my Zigbee coordinator stick. Still attached to my pi-cluster so… Found this docker approach https://www.zigbee2mqtt.io/guide/adapters/flashing/flashing_via_cc2538-bsl.html?fbclid=IwAR30bhQSMBWQ82gyIR3tewr0VUktJWETEUjWFt_pSznuYe8yj0veOWEJyCw#method-with-docker-linux-only
Since I don't have docker on my pi host I did it as a k8s job. First time I updated firmware via k8s :D
apiVersion: batch/v1
kind: Job
metadata:
name: update-sonoff-firmware
spec:
template:
metadata:
spec:
volumes:
- name: usb0
hostPath:
path: /dev/ttyUSB0
- name: sonoff-controller
hostPath:
path: /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_944082cfb512ec118b3721c7bd930c07-if00-port0
containers:
- name: updater
image: ckware/ti-cc-tool
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev/ttyUSB0
name: usb0
- mountPath: /dev/sonoff-controller
name: sonoff-controller
env:
- name: FIRMWARE_URL
value: https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
args: ["-ewv", "-p", "/dev/ttyUSB0", "--bootloader-sonoff-usb"]
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: app
operator: In
values:
- zigbee-controller
# Host with the controller attached is labeled by:
# kubectl label nodes pi1 app=zigbee-controller
restartPolicy: Never
✗ k logs job.batch/update-sonoff-firmware -f
Downloading firmware from https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
Firmware source: 'CC1352P2_CC2652P_launchpad_coordinator_20221226.zip'
Firmware file: 'CC1352P2_CC2652P_launchpad_coordinator_20221226.hex'
sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20221226.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:12:4B:00:24:C7:C7:AE
Performing mass erase
Erasing all main bank flash sectors
Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F980
Write done
Verifying by comparing CRC32 calculations.
Verified (match: 0xa9dc145d)