Chat freely about anything...

User avatar
By IsaiasDg
#27275 Hi everyone,

I'm working in an home automation project where I use ESP8266. Firstly, I set the module in AP mode to set and save SSID data in an eeprom to then change to STATION mode and use the saved data to connect it to access point. The issue is when, consciously or unconsciously, I set and save wrong data and then the module attempts to connect to AP and connection fails, obviously. Then, I set the module in AP mode again, to save right data, and the module attempts to connect but It can't. I found a solution that is reload the code again but for the application that I want to give the module, it isn't useful solution. Someone with this issue that can give me some orientation?. As additional data, I'm using Arduino/ESP8266 IDE 1.6.6.

Thanks in advance
User avatar
By Akhil
#43179 May be you can use AP_STA mode, this way you can test your SSID & PSWD before saving. And you dont need to switch modes.

Also, when you are changing your mode from AP-> STA or STA->AP, ESP STA will not work (same issue i am facing).

What I did :
1) Set AP_STA mode
2) Hosted webserver
3) Clients are served using soft AP IP (Do your EEPROM exercise )
4) Before connecting to HTTP, scan N/w if home WIFI is available (STAtion)
5) if WIFI is available & WIFI.status()== WL_CONNECTED
a) set STA IP= AP IP
b) AP IP=" some other ip"
c) raise http request
d) set AP IP back to original
e) STA IP=" some other ip"

6) if WIFI is available & WIFI.status()!= WL_CONNECTED
ESP.reset();