Since ESPHomeFlasher is basically broken (No Wayland support) here a little guide. As I keep forgetting how this works and like to remind my self.
To flash ESPHome firmware with esptools first install esptools.
pip install --user esptool
or find any other way that allows you to run GitHub - espressif/esptool: Espressif SoC serial bootloader utility
Connect the ESP via USB to the PC. Monitor journalctl to know what TTY is used:
journalctl --follow
Download the modern firmware file from within the ESPHome panel of HomeAssistant:
cd to the location where the firmware was downloaded to. In my case e.g.
cd Downloads
and the firmware file is called white-factory.bin
Then flash the firmware on to the ESP with:
esptool.py --chip esp32 -p /dev/ttyUSB0 write_flash 0x0 white-factory.bin
Notes:
-
On most linux systems a default user cant write to /dev/ttyUSB0. Therefore either root (sudo) must be used, or better the user must be added to the dialout group.
sudo usermod -a -G dialout username
Afterwards one must log out and in again for this to have an effect.
-
If the firmware file doesn’t end on
-factory.bin
it is likely not the modern version. If you flash the legacy version, the ESP will get stuck in a boot loop. I guess the difference between modern and legacy is, that legacy comes without a bootloader, but I never really checked that. -
To check if stuff is working you can use picocom install with:
sudo apt install picocom
and then run it with:
picocom /dev/ttyUSB0 -b 115200
to close picocom press CTL+a and then CTL+q