ESPHome killing Wifi of ESP?

Hi

Running latest version of ESPHome plugin (1.19.4) in hassio (up to date too), I encounter a very confusing issue. I have been using ESPHome with some ESP since quite a while but never got such problem !
I wanted to add some Sonoff Basic in my system. I pulled two of them of my stock and plugged them on power hoping I would have setup a backup AP in it. Got luck with first one, setup it to connect at my current wifi and then use web interface to do OTA update with new wifi credentials. Update successful and then never saw back that ESP either in backup AP mode or connected at my Wifi !
I connect then to it in serial mode and then discover that:

sing '/dev/ttyUSB4' as serial port.
Showing logs:
[15:13:37][D][wifi:380]: Found networks:
[15:13:37][D][wifi:382]:   No network found!
[15:13:42][D][wifi:365]: Starting scan...
[15:13:48][D][wifi:380]: Found networks:
[15:13:48][D][wifi:382]:   No network found!
[15:13:50][D][sensor:117]: 'chambre_lumiere_lit Uptime': Sending state 0.50773 minutes with 0 decimals of accuracy
[15:13:53][D][wifi:365]: Starting scan...

Looks like the ESP wifi part is dead no ? (I have quite a few wifi around plus my own so it can’t say: No Network found…

Ok it happens, electronic can die so do same process on second Sonoff Basic to get exactly same result ! Two ESP devices that have no more Wifi !
For info but nothing special in sketch I use:

substitutions:
  friendly_name: chambre_lumiere_lit

esphome:
  name: $friendly_name
  platform: ESP8266
  board: esp01_1m

wifi:
  networks:
  - ssid: !secret wifi
    password: !secret wifi_passwd
  - ssid: !secret wifi_puppy
    password: !secret wifi_puppy_passwd
  ap:
    ssid: $friendly_name

api:

logger:

ota:

captive_portal:

web_server:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    id: "Button"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: $friendly_name "Relay"
    pin: GPIO12
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes

sensor:
  - platform: wifi_signal
    name: ${friendly_name} WiFi Signal
    update_interval: 60s
  - platform: uptime
    name: ${friendly_name} Uptime
    filters:
      - lambda: return x / 60.0;
    unit_of_measurement: minutes

Someone else with same issue ? that is a little annoying :sleepy:

Vincèn

Can you format your code so I can have a look ?

Section 11 here:

Are you absolutely sure the is a 2.4Ghz wifi availabe?

Also (but not sure because code is not properly formatted, I see you use:

that means in your sisutation it proably will only look for the wifi ssid !secret wifi and/or !secret wifi_puppy.

And lastly, you have no "backup ap configured. That must be in the likes of:

oups sorry corrected :wink:

I have quite a few other ESPHome devices running right now around the house so yep :smiley:

which is correct like all my other ESP devices that are running fine !

I made a clean build just in case but same result ! I waited it switches to AP mode but I can’t see the AP with my phone so it looks like the Wifi part is not working !

As you have serial access, try experimenting by simplifying your wifi configuration by only specifying one ssid and no ap mode or captive portal.

I see that you have two wifi networks stated. I also tried this multiple wifi networks option and module also didn’t connect. When i went back to one wifi only works fine. (Had to reprogram it via serial, sure). I didn’t dig into the problem, though.

Supposely module should connect to either of them, but it seems that something is broken in code, so it doesn’t see any wifi…?

What I discovered today. I don’t know if this applies to the OP’s problem.

Sonoff Basic V1.1
I copied a working node that was using version 1.16.2.
I renamed the device then uploaded the new bin by OTA. Which also upgraded the Sonoff to version 1.19.4.
Worked great, but I wanted to make a couple of “tweaks” to the code. When I clicked on “install”, the upload failed. Couldn’t connect to the device. I was getting " Probe Request Unsuccessful" errors.

Here’s what I discovered through experiments.
Removing AP: and captive_portal: dropped my memory from

RAM:   [=====     ]  46.5% (used 38064 bytes from 81920 bytes)
Flash: [====      ]  40.6% (used 415824 bytes from 1023984 bytes)

to

RAM:   [====      ]  44.1% (used 36164 bytes from 81920 bytes)
Flash: [====      ]  37.4% (used 383048 bytes from 1023984 bytes)

Two percent. Not much. I had to flash by UART because the device would not connect to WiFi.
After flashing, the device now connects to WiFi and OTA functions as expected.

I was under the impression that 50% RAM was where I did not have enough RAM to OTA. But mine failed at 46%.