[GH-ISSUE #200] _tryWPS = true; #161

Closed
opened 2026-02-28 01:23:45 +03:00 by kerem · 4 comments
Owner

Originally created by @johnpica on GitHub (Jul 23, 2016).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/200

If I set _tryWPS = true;
and the WPS fails then the configuration of the access point doen't have an IP

_WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
_WM: START WPS
*WM: END WPS

_WM: SET AP STA
Entered config mode
0.0.0.0
ESP13799641
*WM:
*WM: Configuring access point...
*WM: ESP13799641
_WM: AP IP address:
*WM: 0.0.0.0

*WM: HTTP server started

Originally created by @johnpica on GitHub (Jul 23, 2016). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/200 If I set _tryWPS = true; and the WPS fails then the configuration of the access point doen't have an IP _WM: *WM: AutoConnect *WM: Connecting as wifi client... *WM: Using last saved values, should be faster *WM: Connection result: *WM: 0 *__WM: START WPS *WM: END WPS_* _WM: SET AP STA Entered config mode 0.0.0.0 ESP13799641 *WM: *WM: Configuring access point... *WM: ESP13799641 *__WM: AP IP address: *WM: 0.0.0.0_* *WM: HTTP server started
kerem closed this issue 2026-02-28 01:23:45 +03:00
Author
Owner

@tzapu commented on GitHub (Jul 24, 2016):

hi

this is exactly why i have not made the function public, have not found a way to make it work if it fails to connect yet

alex

On 23 Jul 2016, at 14:17, johnpica notifications@github.com wrote:

If I set _tryWPS = true;
and the WPS fails then the configuration of the access point doen't have an IP

WM:
WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
*WM: START WPS
*WM: END WPS

WM: SET AP STA
Entered config mode
0.0.0.0
ESP13799641
WM:
*WM: Configuring access point...
*WM: ESP13799641
*WM: AP IP address:
*WM: 0.0.0.0

*WM: HTTP server started


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/tzapu/WiFiManager/issues/200, or mute the thread https://github.com/notifications/unsubscribe-auth/AC2FkG896fO6XaczCQo5XlcCkeZb9hJuks5qYfhDgaJpZM4JTVs-.

<!-- gh-comment-id:234763761 --> @tzapu commented on GitHub (Jul 24, 2016): hi this is exactly why i have not made the function public, have not found a way to make it work if it fails to connect yet alex > On 23 Jul 2016, at 14:17, johnpica notifications@github.com wrote: > > If I set _tryWPS = true; > and the WPS fails then the configuration of the access point doen't have an IP > > WM: > _WM: AutoConnect > *WM: Connecting as wifi client... > *WM: Using last saved values, should be faster > *WM: Connection result: > *WM: 0 > *WM: START WPS > *WM: END WPS_ > WM: SET AP STA > Entered config mode > 0.0.0.0 > ESP13799641 > _WM: > *WM: Configuring access point... > *WM: ESP13799641 > *WM: AP IP address: > *WM: 0.0.0.0_ > *WM: HTTP server started > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub https://github.com/tzapu/WiFiManager/issues/200, or mute the thread https://github.com/notifications/unsubscribe-auth/AC2FkG896fO6XaczCQo5XlcCkeZb9hJuks5qYfhDgaJpZM4JTVs-.
Author
Owner

@johnpica commented on GitHub (Jul 24, 2016):

Hi
I use this workaround... upload first the sketch example ESP8266WiFi/WifiAccessPoint
after I upload my sketch... It looks like if I do like this on my esp8266-13 I get IP if WPS fails

//WiFi.mode(WIFI_STA); //comment
delay(1000);
// Called to check if SSID and password has already been stored by previous WPS call.
// The SSID and password are stored in flash memory and will survive a full power cycle.
// Calling ("",""), i.e. with blank string parameters, appears to use these stored values.
WiFi.begin("","");
// Long delay required especially soon after power on.
delay(7000);

// Check if WiFi is already connected and if not, begin the WPS process.
if (WiFi.status() != WL_CONNECTED) {
Serial.println("\nAttempting wifi connection ...");
WiFi.beginWPSConfig();
// Another long delay required.
delay(3000);
if (WiFi.status() == WL_CONNECTED) {
Serial.println("Connected!");
Serial.println(WiFi.localIP());
Serial.println(WiFi.SSID());
Serial.println(WiFi.macAddress());
}
else {
Serial.println("Connection failed!");
//creem un captive AP
Serial.print("Configuring access point...");
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
//reset settings - for testing
//wifiManager.resetSettings();
//set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
wifiManager.setAPCallback(configModeCallback);
//fetches ssid and pass and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if(!wifiManager.autoConnect()) {
Serial.println("failed to connect and hit timeout");
//reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(1000);
}

  }

}
else {
Serial.println("\nConnection already established.");
}

<!-- gh-comment-id:234788805 --> @johnpica commented on GitHub (Jul 24, 2016): Hi I use this workaround... upload first the sketch example ESP8266WiFi/WifiAccessPoint after I upload my sketch... It looks like if I do like this on my esp8266-13 I get IP if WPS fails //WiFi.mode(WIFI_STA); //comment delay(1000); // Called to check if SSID and password has already been stored by previous WPS call. // The SSID and password are stored in flash memory and will survive a full power cycle. // Calling ("",""), i.e. with blank string parameters, appears to use these stored values. WiFi.begin("",""); // Long delay required especially soon after power on. delay(7000); // Check if WiFi is already connected and if not, begin the WPS process. if (WiFi.status() != WL_CONNECTED) { Serial.println("\nAttempting wifi connection ..."); WiFi.beginWPSConfig(); // Another long delay required. delay(3000); if (WiFi.status() == WL_CONNECTED) { Serial.println("Connected!"); Serial.println(WiFi.localIP()); Serial.println(WiFi.SSID()); Serial.println(WiFi.macAddress()); } else { Serial.println("Connection failed!"); //creem un captive AP Serial.print("Configuring access point..."); //WiFiManager //Local intialization. Once its business is done, there is no need to keep it around WiFiManager wifiManager; //reset settings - for testing //wifiManager.resetSettings(); //set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode wifiManager.setAPCallback(configModeCallback); //fetches ssid and pass and tries to connect //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration if(!wifiManager.autoConnect()) { Serial.println("failed to connect and hit timeout"); //reset and try again, or maybe put it to deep sleep ESP.reset(); delay(1000); } ``` } ``` } else { Serial.println("\nConnection already established."); }
Author
Owner

@johnpica commented on GitHub (Jul 24, 2016):

ignore my last comment... the problem now is that the WPS function is not working anymore.

<!-- gh-comment-id:234791592 --> @johnpica commented on GitHub (Jul 24, 2016): ignore my last comment... the problem now is that the WPS function is not working anymore.
Author
Owner

@malebuffy commented on GitHub (Apr 29, 2017):

found a workaround..
make a fake connection before trying to reconnect with wifimanager after a failed wps connection

WiFi.begin("foobar",""); // make a failed connection

<!-- gh-comment-id:298173243 --> @malebuffy commented on GitHub (Apr 29, 2017): found a workaround.. make a fake connection before trying to reconnect with wifimanager after a failed wps connection `WiFi.begin("foobar",""); // make a failed connection`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#161
No description provided.