Flashing ESPHome with Docker
ESPHome’s WebSerial connection didn’t work for me, and the computer running ESPHome was a bit far.
Instead, I decided to run a local copy of ESPHome to flash the firmware over USB, and figured it’s an incantation worth keeping
First, save your target yaml locally, e.g. device.yaml
.
Then:
docker run --rm -it --device /dev/ttyUSB0 -v .:/app:ro ghcr.io/esphome/esphome run /app/device.yaml --device /dev/ttyUSB0
Some breakdowns:
docker run --rm -it
is the usual. Remove image when done, use tty--device /dev/ttyUSB0
: Mount ttyUSB0 (your esp device) to the docker container-v .:/app:ro
make the local directory available as readonly to the container as/app
- image name
run /app/device.yaml
flash said file, which we mounted--device /dev/ttyUSB0
flash to this device
Keep this running until you see the device log reporting successfully connecting to wifi