Although discussed many times, I feel like there’s no definitive answer so far.
What I bought:
An ESP-01 based relay:
USB 8266 Adapter:
Goal and what I did:
Naturally, I wanted to implement this relay to Home Assistant. I already flashed some Sonoffs before, so I thought I had enough experience by now.
So I grabbed ESPHome Flasher and went to town. As always, I created a blank bin file in ESPHome integration in home assistant. Using Generic ESP8266 device type. (I suspected this to be a possible issue but maybe not)
I took out the ESP01 board from the relay and connected it to my PC using the adapter.
Then, I fired up the ESPhome flasher, selected the bin file, clicked Flash aaaand…
Unexpected error: could not open port ‘COM5’: PermissionError(13, ‘Access denied.’, None, 5)
Of course, I tried Googling multiple solutions so here’s what I did so far:
Downloaded the latest USB to UART drivers (already had those from previous flashing)
Used all the possible USB ports on the computer
Tried compiling the BIN file with Esperiff ESP-01 512k module device type
Tried using the FTDI adapter with the pins on the relay
Ran the flasher in admin mode
All methods resulted in the very same error.
I would loved any inputs on the issue, thanks!
Yes I saw that specific site during my research. As the OP there, I tried using the flasher in standard and admin mode. Both gave the same results.
I thought it might be a Windows issue myself, but I tried pretty much everything.
Rebooting, updating the drivers, admin modes … nothing.
What’s even more interesting that I already flashed some NodeMCUs couple days ago using the exact same method. It all worked then (after some driver installs of course)
I don’t know Windows well enough, but perhaps it can throw a Permission Denied error when in fact there is a hardware issue (for instance the USB-to-TTL stick not being able to detect the ESP01).
I assume that you put the ESP01 board on the adapter in the right orientation?
As @randytsuch suggests, you could try connecting GPIO0 to GND. Looking at this page, not all adapter modules actually do that.
If you decided to use the same USB 8266 adapter as I did, you will need to jump the GND and GPIO0 pins during boot. As hinted in the link, you can solder a jumper or a button for easy access.
If you’re like me, you’ll hold a jumper wire at the pins as you insert the USB adapter. You need to hold it there only for the boot, not for the entire process.