ESPHome device won't connect to WiFI after upgrading to 1.20.4

Hi @paddy0174, I mostly use OTA. For the first flash, because I am running ESPHome as an add-on in Home Assistant, I compile the binary on the Raspberry Pi 4 that hosts my HA instance. I download the binary through Firefox on my desktop computer, and flash the Sonoff (or whatever) with an FTDI interface.

So what I now need to do is plug the FTDI into the Pi4, and see if I can get some serial logs. I’m not sure how the Pi4 will know which of my ESPHome devices is plugged into the USB, but I’ll jump off that bridge when I come to it.

Nope, no need to connect it to the rPi4. Use your desktop computer, as you do now, and just get the logs there.

What is the FTDI interface you are using? ESPHome-Flasher?

If you wouldn’t mind, just use ESPHome-Flasher, there is a log button right under “Flash ESP” and this get’s you the logs you need.

EDIT: Can’t find a better picture, sorry. Take a look here, you see the “View Logs” button:

Hi @paddy0174, please ignore the DM I just sent you, I sent it before I read your reply here.

I just flashed a normally-working Sonoff with the ESPHome-Flasher tool you linked me to. However, it did not display any serial logs at all. I think the reason for this is that Sonoffs need to be power cycled after a flash.

I tried to get around this by disconnecting just the power pin and reconnecting it, and all I got was this:

[12:10:49]rd[I][logger:170]: Log initialized
[12:11:20][C][ota:378]: There have been 0 suspected unsuccessful boot attempts.

This is from a device that doesn’t have the problem and uses the default DEBUG logging. Surely there should be more data? What am I doing wrong?

OK, I’ll ignore your DM (already read it, but “psssst” :rofl: ).

I have to admit, it’s been a long time since I’ve done this, but this sounds not right, a little more info should be available.

Give me some time, I’ll try it with one of my own Sonoffs when I get back home tonight (could be a little later, right now it’s 3pm in Germany and I have to attend a birthday dinner tonight :smiley: ), and I’ll see what my Sonoffs report.

Just as a safety precaution, you’re not running this Sonoff directly from your power line, are you? What I mean is the 110V/230V line. That would be very dangerous, please don’t do this (I don’t think so, but just to be sure!). While flashing and checking logs it must only be connected to the FTDI, not the power line! :wink:

I’m stupid about a lot of things, but not that stupid.

@DeeBeeKay, If you’ve got the device connected to a Windows PC with an FTDI interface, then it’s pretty easy using the PuTTY terminal emulator program. Open PuTTY, specify a SERIAL connection, select your appropriate COMx: port, set the baud rate to 115200, and let her rip. If you’re fortunate enough to have a reboot/reset switch on the ESP8266, that helps you obtain output from the very earliest stages. Now, if you want to capture those logs to a text file, PuTTY will do that for you, as well.

Hi @FredTheFrog, thanks for that description of the process.

Note that I am trying this with a working Sonoff, to get the procedure down before pulling a version 1 out of the wall.

I followed your procedure, and used Putty to connect to the Sonoff over COM3 (which is what the FTDI interface is). Initially it produced nothing, so I reset the Sonoff by disconnecting the VCC pin and reconnecting it. I did then get some output over the serial connection, but it is virtually identical to what I got using the ESPHome-Flasher tool. Specifically, this:

[I][logger:170]: Log initialized
[C][ota:378]: There have been 0 suspected unsuccessful boot attempts.

Is that normal?

What is logger level set to?

logger:
  level: VERBOSE

Yes, that is pretty much normal. Depending on your device and its lowest level boot code, you may see a few registers and a boot
/reset message before that ESPHome output. Not ordinarily useful, but interesting and definitely useful when the device is failing to boot properly.

That’s about right. If everything is operating properly, the log output you get is mostly the same as what you get over the network (and it might not be that much when the device is running). However, when the device crashes, there should be a lot more information printed over the serial output.

The OTA message about unsuccessful boot attempts is normal.

Very odd…ran into the same thing. Flashing a magichome LED controller and no logs, no wifi connection, seemed dead in the water…until I set the log level to INFO. Thank you for figuring this out!

Hi @oxan,

OK, here’s my plan of action. I’m going to first run the new update to get ESPHome 2021.8.0. Then I’m going to do an OTA flash of one of the Sonoffs that I know had this problem, first editing the yaml to restore the logger to its default DEBUG level.

If it fails to connect to WiFi after the update, I’ll go fetch it out of the wall (it’s easy to get to, just inside a light switch), plug it into the FTDI, and report back what the log says.

Here goes.

2 Likes

I’m sorry I haven’t reported back for so long, there have been some real life crises to deal with that have prevented my following up on this.

The node I am trying to flash OTA is riiiiight on the edge of my WiFi coverage, and the pipe keeps breaking when I attempt to do the update. Tomorrow I will pull it out of the wall and flash it manually. Sorry to keep you all waiting.

Hi @oxan, SUCCESS!

I flashed one of the Sonoff R2 V1.0 units with the new ESPHome 2021.8.0, with the debug level set to default (I commented out the level: INFO line). The device now boots normally, connects to WiFI, and returns the usual level of log information that you would expect OTA.

I am seriously relieved because honestly, I didn’t want to dig it out of the wall. It’s doable but it’s always a pain.

A few posts ago, you said you significantly reduced the size of the binary. Do you think this lends credence to the idea that the theory about amount of memory is what is causing this?

Anyway, thank you for your continued work on this problem, and again, my apologies for taking so long to get back to you. My elderly mother has just been diagnosed with dementia, and I had to take a road trip to go sort some things out for her, which took time.

Thanks

1 Like

You’re wifi block fixed in on my 8285 (ESP0Mx DevKIt

Thank you

I should have searched for this earlier! I have several Magic Home units flashed with esphome and all working fine except one, I was tearing my hair out thinking it was a wi-fi issue or board issue. Thank you all!

I also had some problems with a sonoff basic connection to wifi

It turns out this is working:

status_led:
  pin:
    number: GPIO13
    inverted: yes

And this is not working:

light:
  - platform: status_led
    name: "Switch state"
    pin:
      number: GPIO13
      inverted: yes

I’ve found that you can flash just about any firmware on an old Sonoff (including logger, CP, etc.) I first flash with Tasmota (basic), and then OTA with a downloaded Esphome firmware.

Hopefully this helps someone. I was having issues reconnecting after using the addon UI. After a lot of debugging, I realized that secrets.yaml on my HA machine was out of sync with what I have locally (since I don’t check it in to git). My ESP devices were trying to connect to a network that didn’t exist.

Worked for me too, thought my Sonoff Basic was dead but… its back as a result! Many thanks :smiley:

1 Like