How does the fallback AP work?

I added a text_sensor entry for a test device (Sonoff Basic), reflashed it successfully and now the device would not reconnect to my WiFi AP. I have no idea how a text_sensor addition, followed by a successful flash could break the device - bad luck I guess.

I had the following configuration on the device:

wifi:
  ssid: "MYSSID"
  password: "mypassword"
  domain: .swtk.info

  ap:
    ssid: "${name}"
    password: "mypassword"

Since ${name} is switch03, I see a switch03 AP appearing on my phone. When connecting there I get the 192.168.4.2 IP address, gateway (= the device) is 192.168.4.1

Now what?

The documentation mentions an extra captive_portal entry for the configuration, which apparently enables a captive portal. If this is the case (I did not have that entry), what is the use for the fallback AP? How to use it without captive_portal enabled?

If both go together, is there a reason to have captive_portal at all? (as opposed to having it automatically enabled as part of the ap: fallback)

Guessing here as I have not used it, but if you connect to the AP with your phone or PC can you access the device via the esp home addon?

I always thought it was a fallback ap as in Tasmota, where you can enter 2 WiFi networks. Apparently not :frowning:

You can do that though. https://esphome.io/components/wifi.html#connecting-to-multiple-networks

I connected via my laptop to have all the needed tools (esphome and network ones).
None of the expected ports are open.

There is some networking available (the AP, and then the IP provided by this AP via DHCP to my laptop), but the “service” part seems to have crashed, as well as the “connection to the wifi” one

The device does blink and reacts to the physical button.

Well, I will have to dig the cables and USB dongle :frowning:

I opened an issue with ESPHome(https://github.com/esphome/issues/issues/1440) on that subject as it seems that some unrelated YAML additions may break (?) the Wi-Fi connections (logger: was one example).

I think that for a useful fallback you need captive_portal

I had to rely on the fallback AP recently when I switched DHCP servers. All my esphome devices freaked and wouldn’t come back online. I connected to the fallback AP wifi, navigated to I think 192.168.4.1 or whatever it is, and then was presented with a nice little interface where I could re-enter the wifi credentials. There was also an option to upload a new binary I think.

1 Like

That functionality requires you to specify captive_portal: as well as ap:

OK so i have this issue

I have purchased 4 x Kogan Smart Plugs from another user on the forum. He had them configured for ESPHome use (i assumed Tasmota and did not think anything of it)

I finally got around to breaking them out of the box today to setup and found that they are configured for ESPHome

They do seem to have the Fallback AP setup and the guy who sold me the units has given me a prompt reply with the password for the fallback AP - BUT it appears that Captive portal was not loaded - so what can i do with them now ? i.e. how can i get them to a state where i can cross flash Tasmota onto these ?

Craig

If they are version 1 plugs (no USB ports) you can easily open them and flash them via a serial connection. V2 plugs are not opened so easily.

1 Like

Yep they are V2 - and definitely do not want to destroy them by opening them.

Surely Otto has given some thought to recovering plugs like this ? (And then the next step is cross flashing to tasmota as this is what i use on all my Sonoffs etc)

Craig

Well, this was basically the core of my question: how to use ap: without captive_portal:. Maybe this has changed since the time I asked the question but I still do not understand how ap: on its own is useful at all.

@WoJWoJ Did you ever find a solution? I’m having this exact problem and I have the plug installed… would be a bummer if I had to remove it from the wall to re-flash.

@cjazinski I ended up adding both the ap: and the captive portal configuration. It looks to me as if there was an AP configuration that enables the AP, but that it is useless without the captive portal. IMHO they should be merged.

There is however another problem: Is 1.15.2 or 1.15.3 with web_server compatible with a Sonoff Basic? – last time I checked it was still there (but this needs to be checked, just don’t update everything at once)