0

Hey all I have a C# program that allows me to upload the .BIN file to my ESP8266 (Wemos D1 mini) board and that does just fine at updating the .ino code if updates are needed.

However, I am wondering how I would go about doing that if my wifi network changes the password to access the wifi?

I use mDNS in order to not care about the wifi's IP address but I have yet to find anything that would still allow me to do an OTA update when the wifi has changed its password from the one coded in the .ino file.

So if I save the password into the SPIFF, how would I access the Wemos D1 mini if the password changes and I needed to update the password on the Wemos D1 mini to reflect that password change? It would seem to me that it would not connect since the old password would be used when asking to do a OTA update?

I may be over thinking this - or missed something very obvious that I am looking over but any ideas on how to fix this issue would be great!

StealthRT
  • 10,108
  • 40
  • 183
  • 342

1 Answers1

0

If the ESP8266 can no longer connect to your WiFi network, you could always launch it's own access point instead. I did something similar, and had it launch the Soft AP after a couple minutes of being unable to connect. It would then allow you to push firmware updates to it, or change the password via a web API.

Example of updating firmware via a Soft AP + update server: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPUpdateServer/examples/WebUpdater/WebUpdater.ino

ArduinoOTA should just work as normal as well in Soft AP mode.

Other than the above two, you could always use the ESP8266's "SmartConfig" mode, which allows you to set the password without association to an access point via a mobile app. With this, you shouldn't require a firmware update just to change the password.

To enable SmartConfig mode:

WiFi.beginSmartconfig()
... 
WiFi.stopSmartConfig()
Dawn Minion
  • 905
  • 5
  • 12
  • Thanks for the reply, Dawn. Would you mind providing code or links to code examples of this? – StealthRT Sep 06 '18 at 14:23
  • @StealthRT - Added an example of each above. I'd say your best bet is via the update server - In my experience the smartconfig mode hasn't been wonderfully reliable, but, I never had issues with the server. – Dawn Minion Sep 06 '18 at 14:54
  • Hum that **WebUpdater** doesn’t seem like it would work. Looks like it just loops until it connects but it’s using the hard coded ssid and password so it never would when those change? – StealthRT Sep 06 '18 at 16:26