Retry WIFI connect while in AP mode?

Folks,

I had a (self induced) power outage in my wifi router yesterday, and subsequently all my ESPHOMEs apparently did not reconnect. I pushed the reset button on all, and we were back in business.

I presume they went into AP mode. As I have set

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-xxx"
    password: "xxx"

captive_portal:
    

Will ESPHOME try to wifi connect, even when in AP mode?

Says:

ap_timeout (Optional, Time): The time after which to enable the configured fallback hotspot. Can be disabled by setting this to 0s, which requires manually starting the AP by other means (eg: from a button press). Defaults to 1min.

and:

reboot_timeout (Optional, Time): The amount of time to wait before rebooting when no WiFi connection exists. Can be disabled by setting this to 0s, but note that the low level IP stack currently seems to have issues with WiFi where a full reboot is required to get the interface back working. Defaults to 15min. Does not apply when in access point mode.

Is there any way to teach the ESP to do the best of the two worlds: Open an AP for emergency or PW change - but reconnect once the wifi is back?

Thx alot!

1 Like

Just curious: do you need AP? I don’t… i don’t have AP set up in any of my devices. I use fixed IP, fixed SSID and password (wrote down in yaml itself), so i see no need for AP. I also don’t have “captive_portal’” in any of my devices. If you remove AP then module will restart after “restart_timeout”:

  • when there”s no wifi connection,
  • when there’s no connection to HA via API (if you use api, not mqtt).

Thx Pavel,

disabling the AP fall-back would require me to physically remove all ESPs and serial-flash those if at any point I need to reconfigure my wifi. E.g. I recently had to change the wifi password, that would lead to quite some some effort.
(If it is planned one could OTA all with new credentials, while the old config is still live, knowing they would not be connecting, as the new config is not yet active)

I was hoping to get free lunch with AP and retry at the same time.

Cheers

Henrik

I see you… although it’s questionable which is faster:

  • do OTA of all devices before changing password or
  • connect to each one of them and change password of each manually…

since it’s possible to have wifi credentials in one file only for all esphome devices (with include…file in yaml) i dare to say that first option is way faster, since you just change password in that file and click “update all” in esphome web interface…

I have wifi credentials and sensors, which are in all devices stored in that file (like wifi signal strength, uptime, connection led…)

Hi there,

So is the answer to this question “no”?

Thanks,
Tom

Pavel,

I agree if you plan for it, you can update all ESPs with new WIFI data.
Accept that they are offline until all are done and the new WIFI is up.

If everything works you are good to go.
If not… serial flash…