Close

Old WSL instructions

A project log for ESPHome on ESP-01 Windows Workflow

Workflow for creating and flashing ESPHome firmware to ESP-01/ESP8266 on Windows

schlionschlion 12/01/2020 at 16:170 Comments

Apparently esphome works from windows :D

So this is kind of obsoltete



There is also a reddit post about getting WSL2 to work with USB but I would rather not use docker.

I just used WSL2 ubuntu and installed esphome in there, then copied the files out of WSL2 and then flashed it from windows. After the first successful flash, you can just use the OTA update function directly from WSL2. For OTA to work it's important to get ESP-01 with 1MByte (8Mbit) of flash. Since otherwise there is not enough space to save the new firmware in parallel to the old one before flashing.

Getting WSL

I just followed this guide: https://docs.microsoft.com/en-us/windows/wsl/install-win10

And then got ubuntu from the windows store.

Installing ESPHome

Again I just followed the official guide from inside WSL2: https://esphome.io/guides/getting_started_command_line.html

basically its just:

pip3 install esphome

Making a flashable firmware

If you're new to esphome it's not a bad idea to run the wizard!

mkdir ESPHome
cd ESPHome
esphome livingroom.yaml wizard

 This will create a file called livingroom.yaml which contains all the information to make the firmware. While asking you about how your node will be named (how it will appear on the wifi). Later you will be asked what board you are using, here you should choose esp01_1m. If you choose esp01 OTA will not work, even if your board has 1MB of flash.

Great you now have a recipe for a firmware file. To build the firmware

esphome livingroom.yaml compile

This will make a folder with the name of your node (that you entered into the wizard). In my example its livingroom_node. In a buch of subfolders you can find the actual firmware file.

./livingroom_node/.pioenv/livingroom_node/firmware.bin

Now you can copy that to windows:

mkdir /mnt/c/Users/<your Windows Username>/Documents/ESPHome
cp ./livingroom_node/.pioenvs/livingroom_node/firmware.bin /mnt/c/Users/<your Windows Username>

I just installed esphome on windows esphome in there. After the first successful flash, you can just use the OTA update function directly from Windows or WSL2. For OTA to work it's important to get ESP-01 with 1MByte (8Mbit) of flash. Since otherwise there is not enough space to save the new firmware in parallel to the old one before flashing.

Flashing the file from windows

Flashing the file using utilities like ESPEasy Flasher did not work for me. So instead I got esptool as a python package. I use anaconda, but you can probably just use the pip that came with your python. I made new environment for ESPHome

#make new env
conda create --name ESPHome
# activate env
conda activate ESPHome
#get esphome
pip install esphome

You should probalbly make an extra directory for all your esphome files. I made mine in Documents/ESPHome.

Now connect the ESP01 to your USB-programmer be sure that the chip enters programming mode by keeping the programmin button pressed on power up. Or hold the programming button and press reset.

Now navigate to the firmware file and flash with:

esptool.py --before default_reset --after hard_reset --baud 460800 --chip esp8266 --port COM5 write_flash 0x0 --verify

 Be sure to change your COM port accordingly.

Discussions