[GH-ISSUE #1254] Question: Flag for successful connection #1073

Open
opened 2026-02-28 01:28:24 +03:00 by kerem · 2 comments
Owner

Originally created by @dronecz on GitHub (May 26, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1254

Basic Infos

Hardware

WiFimanager Branch/Release: feature_asyncwebserver

Hardware: Custom ESP32 board

Core Version: 1.0.6

Description

I´m making setup wizard for my device and I have screen where I call function which start WiFiManager and would like to ext this screen when there was successful connection to the network.

Is there any function or callback which I can use for this already?

Originally created by @dronecz on GitHub (May 26, 2021). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1254 ### Basic Infos #### Hardware WiFimanager Branch/Release: feature_asyncwebserver Hardware: Custom ESP32 board Core Version: 1.0.6 ### Description I´m making setup wizard for my device and I have screen where I call function which start WiFiManager and would like to ext this screen when there was successful connection to the network. Is there any function or callback which I can use for this already?
Author
Owner

@tablatronix commented on GitHub (Jun 14, 2021):

Not yet, wm currently shutsdown the ap to attempt the connect (for stability), so maintaining a webservice is a problem.

<!-- gh-comment-id:860310437 --> @tablatronix commented on GitHub (Jun 14, 2021): Not yet, wm currently shutsdown the ap to attempt the connect (for stability), so maintaining a webservice is a problem.
Author
Owner

@dronecz commented on GitHub (Jun 14, 2021):

Thanks for info.

I solved it like this:

void loop() {
if (state == 103) { // state where I turn WM ON via button press
    wifi_config_t conf;
    esp_wifi_get_config(WIFI_IF_STA, &conf);
    apName = String(reinterpret_cast<const char*>(conf.sta.ssid)); // reading SSID from flash which should be empty
    if (apName != NULL) { // if SSID is not empty 
      Serial.println("Registered new SSID: " + apName);
      startTime = millis(); 
      if (WiFi.localIP()[0] > 0) { // if IP address is not 0
        setupWiFiScreenDone(); // call for scrren which shows full IP address
      } else {
        //if we did not get IP address, we have to clear SSID
        WiFi.disconnect(true);
        Serial.println("No IP address, restart WiFi setup.");
        setupWiFiScreenFail(); //information screen, which after timout calls another screen with state 103
      }
    }
  }
}

This works, but I have to enter SSID manualy as I have this issue.

<!-- gh-comment-id:860993533 --> @dronecz commented on GitHub (Jun 14, 2021): Thanks for info. I solved it like this: ``` void loop() { if (state == 103) { // state where I turn WM ON via button press wifi_config_t conf; esp_wifi_get_config(WIFI_IF_STA, &conf); apName = String(reinterpret_cast<const char*>(conf.sta.ssid)); // reading SSID from flash which should be empty if (apName != NULL) { // if SSID is not empty Serial.println("Registered new SSID: " + apName); startTime = millis(); if (WiFi.localIP()[0] > 0) { // if IP address is not 0 setupWiFiScreenDone(); // call for scrren which shows full IP address } else { //if we did not get IP address, we have to clear SSID WiFi.disconnect(true); Serial.println("No IP address, restart WiFi setup."); setupWiFiScreenFail(); //information screen, which after timout calls another screen with state 103 } } } } ``` This works, but I have to enter SSID manualy as I have [this ](https://github.com/tzapu/WiFiManager/issues/1121#issuecomment-840089847) issue.
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#1073
No description provided.