Messed up initial flash, fallback AP is not available

First time ESPHome flasher here. I was trying to install ESPHome on a Sonoff Mini, but i have messed up the network config in the .yaml file - exchanging static ip with default gateway and not putting wifi SSID and password in apostrophes. So now my sonoff mini is not connecting (obviously), but fallback wifi should still be seen. However its not.

Is there any way how to fix this without serial flashing?

Here’s the relevant parts of my .yaml file:

  name: sonoff_mini_backyard
  platform: ESP8266
  board: esp01_1m

  - ssid: wifi
    password: password

#Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: 'Sonoff Mini Back'
    password: 'password'


# Enable web server
  port: 80

# Enable logging

# Enable Home Assistant API


Do you ‘see’ an ssid upon powering on the device?

If not I am afraid you will have to open up and flash via serial…

That’s exactly it, that I don’t see any SSID. I am thinking that I may be able to create a wifi network where my messed up config would be correct, so I could connect the device correctly.

Anything that works will do :smiley:

except that it doesn’t work :frowning: i have set up a spare router with the same SSID, subnet, set the gateway to, disabled my main wifi that has the same ssid, but it still does not connect…

the two reasons I can imagine:

  • the missing apostrophes around the wifi credential (shouldn’t the yaml validity check in ESPHome catch this?)
  • enabling the webserver in combination with captive portal messed things up somehow

Nope forget that ! I would try to switch off your main wifi (the one your mini is supposed to connect to), put the Mini on power and then you should see the default fallback IP show up after 2/3 minutes and then be able to flash it with correct firmware :wink:

@vincen tried that as well. still no AP…

things i noticed:

  • with my wifi disabled the device blinks once. with wifi enabled it blinks twice (which should signalize connection error)
  • pressing the button switches the relay
  • holding the button for 5 secs enters some kind of pairing mode - solid light with two blinks (but AP is still not visible)

are there any other tricks with the button that should do something? i have no adapter to perform a serial flash, but it’s on its way from china. will take a couple of weeks until it arrives. I have two more spare Sonoff Mini’s that I can try to brick as well, but rather be sure what I did wrong beforehand :wink:

You did nothing wrong.

Keep in mind might be best to choose ap name with single word. And if your password is numbers only its a good habit to use " " around it.

As indicated by @sender you did nothing wrong out of inversing ip of router and ip of device ! For your second try I would remove for test the fixed IP assignment (you can also remove the port 80 in webserver as it’s default so no need to indicate it !

you won’t believe this, but i managed to brick a second sonoff mini, this time with correct IP addresses (forgot to take out of the static IP part as @vincen suggested :man_facepalming:).

I still don’t have a USB-COM bridge, but my ESP32 board arrived today (for the record, i was able to flash it with ESPhome without any problems this time). I am planning to use it to collect data from BLE thermometers, but it seems I could use it to flash other devices as well.

if this description is correct shorting the GND and RST pins and connecting the GND, 3V3, RX and TX pins to the Sonoff should work.

My question: with the above connection will the board work as a kind of “USB-COM” passtrough or do i need to create a special firmware for that to work?

This doesn’t sound like esphome but rather like a stock firmware. Which way did you choose to flash the device?

And why still waste time with static ip’s? It’s past the year 2000 already :wink:

Exactly that.

When you compile the firmware in esphome you can download it. And upload (flash it) via the usb com port using Releases · esphome/esphome-flasher · GitHub.

I had that idea too. but the device does not connect to anything. no eWelink or DIY mode AP appears…

via Sonoff DIY OTA flash. of course after enabling DIY mode and OTA flash according to this guide Sonoff DIY - Tasmota

Did you configure a action in your esphome yaml when the button is pressed for 5 seconds then? If not you can be 110% sure there is no esphome running (yet) on your device…

It looks like there is a bunch of different sonoff mini’s out there (various hardware and soft/firmware revisions) which are flashed differently with ota.

@meneelyt gave a nice write up here: How To: Flash a Sonoff Mini to ESPHome – 2021-01 version

If you can’t access it in any way by ota you are forced to use the serial method (kind of tricky with this device because it only has tiny solder pads)…

@meneelyt s description was exactly the one i followed, i just couldnt find the link when making my previous post.

I was thinking the 5-sec hold is something hardcoded into the bootloader or something, as i certainly did not configure it (nor the blinking pattern, which exactly matches sonoff’s default behaviour). I will give it a few more tries.
Yeah, soldering will be a pain, especially with my skills and tools :frowning:

EDIT: ok, turns out i’m stupid. the device is still in DIY mode and the flash did not go trough apparently (despite the 200 response). I think the problem is that my webserver storing the file switches to HTTPS and the OTA flash is not able to handle this. using the exact same flashing method with docker as listed on finally worked

I can’t find it at the moment, but the Sonoff documentation said exactly that somewhere - that https isn’t supported.

Glad you got it to work.