Giter Club home page Giter Club logo

khoih-prog / esp_wifimanager Goto Github PK

View Code? Open in Web Editor NEW
370.0 24.0 96.0 2.98 MB

This is an ESP32 / ESP8266 WiFi Connection Manager with fallback web configuration portal. Use this library for configuring ESP32 (including ESP32-S2 and ESP32-C3), ESP8266 modules' WiFi, etc. Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP WiFi channel. With examples supporting ArduinoJson

License: MIT License

C++ 60.40% Shell 0.83% C 38.76%
esp-wifimanager configuration-portal web-portal wifi config-portal wifi-credentials arduino hostname dhcp wifimanager

esp_wifimanager's People

Contributors

awaistkd avatar eth0up avatar khoih-prog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp_wifimanager's Issues

Problem with using multiple libraries

Dear Sir,

when i use in my program following two libs:

#include <ESP_WiFiManager.h> //https://github.com/khoih-prog/ESP_WiFiManager
#include "esp_http_server.h"

I am getting an error:

Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Compiling .pio\build\esp32dev\libb6a\WebServer\Parsing.cpp.o
Compiling .pio\build\esp32dev\libb6a\WebServer\WebServer.cpp.o
Compiling .pio\build\esp32dev\liba7e\ESP_WiFiManager_ID6915\ESP_WiFiManager.cpp.o
In file included from C:/Users/ottok/.platformio/packages/framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6/tools/sdk/include/esp_http_server/esp_http_server.h:22:0,
from src\main.cpp:96:
C:/Users/ottok/.platformio/packages/framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6/tools/sdk/include/nghttp/http_parser.h:95:6: error: redeclaration of 'HTTP_DELETE'
XX(0, DELETE, DELETE)

Looks like in http_parser (called from: https://github.com/espressif/esp-idf/blob/master/components/esp_http_server/include/esp_http_server.h) there is following declaration:

/* Request Methods /
#define HTTP_METHOD_MAP(XX)
XX(0, DELETE, DELETE)
XX(1, GET, GET)
XX(2, HEAD, HEAD)
XX(3, POST, POST)
XX(4, PUT, PUT)
/
pathological /
XX(5, CONNECT, CONNECT)
XX(6, OPTIONS, OPTIONS)
XX(7, TRACE, TRACE)
/
WebDAV */ \

and in HTTP_Method.h which is called from WebServer.h which is called from your code in case of ESP32 have a conflict:

#ifndef HTTP_Method_H
#define HTTP_Method_H

typedef enum {
HTTP_GET = 0b00000001,
HTTP_POST = 0b00000010,
HTTP_DELETE = 0b00000100,
HTTP_PUT = 0b00001000,
HTTP_PATCH = 0b00010000,
HTTP_HEAD = 0b00100000,
HTTP_OPTIONS = 0b01000000,
HTTP_ANY = 0b01111111,
} HTTPMethod;

#endif /* HTTP_Method_H */

Maybe you have an idea what to do in such a case ?

Kind Regards
Otto Klaasen

API call /r doesnt clear credentials

Hi,
looks like i ll be nagging a bit more ;)

in:

void ESP_WiFiManager::handleReset function:
WiFi.disconnect(true); // Wipe out WiFi credentials.

and:

void ESP_WiFiManager::resetSettings() function:
#ifdef ESP8266  
  WiFi.disconnect(true);
#else
  WiFi.disconnect(true, true);
#endif

The thing is that erase credentials with disconnect method WORKS only AFTER successful connection to WiFi Router.
I have seen successful "erase" with Wifi.begin("0","0"); but "erase" is actually just overwriting them :)

I will investigate further and if I find something useful I ll post it here :)

EDIT: I forgot to mention also that it worked for a couple of times ........ but in meanwhile i updated lib from 1.0.7 to 1.0.9 and finally to 1.0.10 (by the way static IP gone on CP ... ALL 4 THUMBS UP) and now it works no more :)
I found some discussions: espressif/arduino-esp32#400

Problem when de-energizing the ESP8266

Hello Mr KHOIH. First I would like to congratulate you on your brilliant work.
It worked perfectly on my ESP32 Nodemcu. Now I am migrating to ESP8266, but using the same example "ConfigOnswitch", it does not save the SSID and password parameters when de-energizing ESP8266. So he returns to the config mode. Is there a parameter that I should change to work well as in ESP32?

Greetings from Brazil

CORS protection fires up with AJAX

It is I Leclerc (if you ever watched nowadays prehistoric episodes of ALO ALO :)

So what I did is I commented out all Portal pages but API calls:

#ifndef NO_WWW
  server->on("/", std::bind(&ESP_WiFiManager::handleRoot, this));
  server->on("/wifisave", std::bind(&ESP_WiFiManager::handleWifiSave, this));
  server->on("/r", std::bind(&ESP_WiFiManager::handleReset, this));
  server->on("/scan", std::bind(&ESP_WiFiManager::handleScan, this));
  server->on("/wifi", std::bind(&ESP_WiFiManager::handleWifi, this));
  server->on("/close", std::bind(&ESP_WiFiManager::handleServerClose, this));
  server->on("/i", std::bind(&ESP_WiFiManager::handleInfo, this));
  server->on("/state", std::bind(&ESP_WiFiManager::handleState, this));
  server->onNotFound(std::bind(&ESP_WiFiManager::handleNotFound, this));
#else
  server->on("/ws", std::bind(&ESP_WiFiManager::handleWifiSave, this));
  server->on("/r", std::bind(&ESP_WiFiManager::handleReset, this));
  server->on("/sc", std::bind(&ESP_WiFiManager::handleScan, this));
  server->onNotFound(std::bind(&ESP_WiFiManager::handleRoot, this));
#endif
  server->begin(); // Web server start
  
  LOGWARN(F("HTTP server started"));
}

so in my code i just do a #define NO_WWW and I use my version or omit it and use your version (man i ll use some nasty words when i ll forget about it and just update ur lib - i guess i ll need to get WAAAAY more familiar with git but just clone :)

my code in ESP32 fires up ConfPortal from WM after it receives msg from MQTT

after that i got my friend to make me an app for android to set all my ESP32s for my home automation.
so there i choose MAC address of ESP and I send MQTT to start CP and the android app sends /sc so i get in my phone all WiFis available to ESP but there was a problem because in the request header Origin and Host part arent the same HENCE CORS protection fires up in remote device (phone or computer - any browser).

I did some digging and found out that ANY response from the server needs to have sendHeader("Access-Control-Allow-Origin", "*") in the response header.

###########WARNING##########
this solution IS NOT for regular web servers as this one is on for a minute or so and shuts down - also not available on internet
this warning is for any person finding this POST related to CORS error (and trying to solve apache or any other server on internet !!!!!!!!!!!!
########END OF WARNING#######

so I added another line to the library with handleScan function to solve the problem

void ESP_WiFiManager::handleScan()
{
  LOGDEBUG(F("Scan"));

  // Disable _configPortalTimeout when someone accessing Portal to give some time to config
  _configPortalTimeout = 0;		//KH

  LOGDEBUG(F("State-Json"));
  
  server->sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
  server->sendHeader("Access-Control-Allow-Origin", "*"); // added by Ales to solve AJAX problem of API redirects on client side
  server->sendHeader("Pragma", "no-cache");
  server->sendHeader("Expires", "-1");

I hope things i mentioned comes in hand with preping next update :)

Starting WiFIManger is very slow (2000ms)

Hi,

The original WiFIManager manager was very slow at connecting. A workaround was to try connect with normal WiFI and if that failed after 1000ms, invoke WiFi Manager. This work around does not seem to work with your library on the ESP32.

The debug:

[34 ] Hello
[34 ] Starting WiFiManager
[2249 ] Starting WiFiManager. Done
[2249 ] Stored: SSID = XXXXX, Pass = XXXXXXXXXXX
[2249 ] Starting WiFiManager. Finished all setup
[2250 ] Got stored Credentials. Timeout 60s
[2254 ] Trying to connect.
[2668 ] WiFi connected!

The delay happens here:

 printDebug("Starting WiFiManager");

 ESP_WiFiManager ESP_wifiManager("ConfigOnDoubleReset");
 printDebug("Starting WiFiManager. Done");

The normal duration to connect to my wifi, with and without DHCP is around 200-250ms.
All my other ESP8266 do this with a few exceptions when they bounce to another bssid.

Sample code to show duration.

#define ESP32

  #include <esp_wifi.h>
  #include <WiFiClient.h>

  #define ESP_getChipId()   ((uint32_t)ESP.getEfuseMac())

  #define LED_ON      HIGH
  #define LED_OFF     LOW  

String ssid = "ESP_" + String(ESP_getChipId(), HEX);
const char* password = "your_password";

// SSID and PW for your Router
String Router_SSID;
String Router_Pass;

// Use false if you don't like to display Available Pages in Information Page of Config Portal
// Comment out or use true to display Available Pages in Information Page of Config Portal
// Must be placed before #include <ESP_WiFiManager.h> 
#define USE_AVAILABLE_PAGES     false

#include <ESP_WiFiManager.h>              //https://github.com/khoih-prog/ESP_WiFiManager


// Indicates whether ESP has WiFi credentials saved from previous session, or double reset detected
bool initialConfig = false;


void printDebug(String msg){
    Serial.print("[");
    Serial.print(millis());
    Serial.print("\t\t]\t");
    Serial.println(msg);    
}

void setup() 
{
  // put your setup code here, to run once:
  // initialize the LED digital pin as an output.
 
  Serial.begin(115200);
  printDebug("Hello");

 //Local intialization. Once its business is done, there is no need to keep it around
   printDebug("Starting WiFiManager");

 ESP_WiFiManager ESP_wifiManager("ConfigOnDoubleReset");
 printDebug("Starting WiFiManager. Done");

  ESP_wifiManager.setMinimumSignalQuality(-1);

  // We can't use WiFi.SSID() in ESP32 as it's only valid after connected. 
  // SSID and Password stored in ESP32 wifi_ap_record_t and wifi_config_t are also cleared in reboot
  // Have to create a new function to store in EEPROM/SPIFFS for this purpose
  Router_SSID = ESP_wifiManager.WiFi_SSID();
  Router_Pass = ESP_wifiManager.WiFi_Pass();
  
  //Remove this line if you do not want to see WiFi password printed
  printDebug("Stored: SSID = " + Router_SSID + ", Pass = " + Router_Pass);

  // SSID to uppercase 
  ssid.toUpperCase();
   printDebug("Starting WiFiManager. Finished all setup");

  if (Router_SSID != "")
  {
    printDebug("Got stored Credentials. Timeout 60s");
    ESP_wifiManager.setConfigPortalTimeout(60); //If no access point name has been previously entered disable timeout.
  }
  else
  {
    printDebug("No stored Credentials. No timeout");
    initialConfig = true;
  }
    
  if (initialConfig) 
  {
    printDebug("Starting configuration portal.");

    //sets timeout in seconds until configuration portal gets turned off.
    //If not specified device will remain in configuration mode until
    //switched off via webserver or device is restarted.
    //ESP_wifiManager.setConfigPortalTimeout(600);

    //it starts an access point 
    //and goes into a blocking loop awaiting configuration
    if (!ESP_wifiManager.startConfigPortal((const char *) ssid.c_str(), password)) 
      printDebug("Not connected to WiFi but continuing anyway.");
    else 
      printDebug("WiFi connected...yeey :)");    
  }

  #define WIFI_CONNECT_TIMEOUT        30000L
  #define WHILE_LOOP_DELAY            10
  #define WHILE_LOOP_STEPS            (WIFI_CONNECT_TIMEOUT / ( 3 * WHILE_LOOP_DELAY ))
  
  unsigned long startedAt = millis();
  printDebug("Trying to connect.");

  while ( (WiFi.status() != WL_CONNECTED) && (millis() - startedAt < WIFI_CONNECT_TIMEOUT ) )
  {   
    WiFi.mode(WIFI_STA);
    WiFi.persistent (true);
  
    WiFi.begin(Router_SSID.c_str(), Router_Pass.c_str());

    int i = 0;
    while((!WiFi.status() || WiFi.status() >= WL_DISCONNECTED) && i++ < WHILE_LOOP_STEPS)
    {
      delay(WHILE_LOOP_DELAY);
    }    
  }

  
  if (WiFi.status() == WL_CONNECTED)
  {
    printDebug("WiFi connected!");
  }
  else
    printDebug("Failed to connect");
}

void loop() 
{
 
}

Running on batteries and sleeping for most of of the time, the wasted 1500ms is crucial. My whole program goes to sleep in around 400ms. :)

WorkAround for the esp8266:


void WIFI_Connect(){
    printDebug(F("WiFI setup starting"));

    IPAddress ip(10,10,30,19) ;    //WeatherStationESP
    IPAddress gateway(10,10,30,1);   
    IPAddress subnet(255,255,255,0);   
    IPAddress dns(10,10,50,2);  //Google dns  

    //Serial.setDebugOutput(true);
    //WiFi.printDiag(Serial);

    WiFi.config(ip, gateway, subnet, dns);


    WiFi.mode(WIFI_STA);
    unsigned long wifiConnectStart = millis();
    WiFi.hostname(_HOST_NAME); 

    while (WiFi.status() != WL_CONNECTED) {
      if (WiFi.status() == WL_CONNECT_FAILED) {
        printDebug(F("WiFI connection failed"));
        return;
      }
      if (millis() - wifiConnectStart > 1000) {
        WiFiManager wifiManager;
        printDebug(F("Could not connect with normal wifi. Starting WiFi Manager."));
        wifiManager.autoConnect(_HOST_NAME);
      }
      delay(10);
    }
Serial.print("mac:");
Serial.println(WiFi.softAPmacAddress());
Serial.print("IP Address:");
Serial.println(WiFi.localIP());
    printDebug(F("WiFI setup complete"));    
}

Options / Questions:

  1. Why does WiFi not work on the ESP32? Are the credentials stored elsewhere?
  2. Can it either be improved so the connect time is reasonable (and that change merged back into the original library ๐Ÿ‘ )
  3. Can it be changed so that the original workaround also works?

thanks!

How to use WiFiManagerParameter

From @ILIJA-ILIEV

Hello Sir,
is it possible to use WiFiManagerParameter how it is defined in tzapu/WiFiManager?

I'm moving your question to this new issue. Please don't post next time to non-relating one captive portal: # 36

You can use WMParamenter the same way as in tzapu/WiFiManager. Just change the name from WMParameter to ESP_WMParameter.

For example:

ESP_WMParameter custom_blynk_server("blynk_server", "blynk_server", blynk_server, BLYNK_SERVER_LEN + 1);

There are mane examples demonstrating how to use ESP_WMParameter, such as

  1. AutoConnectWithFSParameters
  2. ConfigOnDRD_FS_MQTT_Ptr

and more.

Conflict with ESPAsyncWebServer.

I'm working in a project that needs Websocket protocol. So I need to use ESPAsyncWebServer library.

This library works together with ESPAsyncWebServer?

I'm using the last version of both libraries and get this errors:

C:/users/leonardo/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:6:18: error: redeclaration of 'HTTP_POST' HTTP_POST = 0b00000010, ^ In file included from src\main.cpp:11:0: .pio/libdeps/esp32doit-devkit-v1/ESP Async WebServer/src/ESPAsyncWebServer.h:56:3: note: previous declaration 'WebRequestMethod HTTP_POST' HTTP_POST = 0b00000010,

This error is repeated several times with others variables. So it seems that there is a redefinition of those variables.

I'm using version 1.0.0 of arduino-esp32 framework.

Thanks in advance. Regards

Websocket client

Thanks for your wonderful work!
I'm trying to implement a websocket client with your excellent library for ESP32
which of all the available websocket libraries do you suggest for best compatibility with ESP_Wifimanager?
Thank you in advance for any advice.

Question about functioning of Configure page

I am have been studying the source code and have a question.
When you "click" on one of the hyperlinks in the networks found list, it populates the SSID field automatically.
I have been studying the code and the html page and don't understand how this works.
I am trying to duplicate this functionality in one of my own pages and haven't been successful.
Can you provide a explanation of how to duplicate this functionality?

Thanks in advance for your help.

Doesn't seem to work when 8266 is running a server application

Arduino: 1.8.9 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Roberts\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.0/tools/sdk/libc/xtensa-lx106-elf/include/stdio.h:63,

This doesn't (seem to) work when the 8266 is running as a server. I've used your ESP_WiFiManager for other applications but when I try to implement it with my server application it hangs. When I comment out my server.begin() in Setup it works but of course then my application doesn't work. Ken Taylor got around this my implementing the COS with an ESP.reset() but I don't see that in your code. (And it seems to be above my pay grade to figure out a work around.) Thx.

EDIT: Just noticed your version ConfigOnSwitchFS retains the ESP.reset(). I'll give that a try. Feel free to close this if that example works with server applications. Oops. I was looking at Ken's yours doesn't seem to do the ESP.reset(). How do you handle "application server already running" when one initiates a COS? (If this isn't a bug then I probably shouldn't be asking it here. And if so is there a forum someplace that handles these questions? Thx.)

Having issue to read the SPIFF file.

Dear Sir,
following code does not seem to work:

// we could open the file
size_t size = f.size();
// Allocate a buffer to store contents of the file.
std::unique_ptr<char[]> buf(new char[size]);
// Read and store file contents in buf
f.readBytes(buf.get(), size);

I get rubish in buf, i had to rewrite like this to be able to read by SPIFF file:

File f = SPIFFS.open(CONFIG_FILE, "r");
String buffer; /// Create a string buffer to get the file contents
//
Serial.println("Get file");
if (!f) Serial.println("FAIL TO LOAD FILE");
while (f.available()){
buffer = f.readString().c_str();
}
Serial.print("file buffer: ");Serial.println(String(buffer)); // Print buffer which contains file contents

char * doc = new char [buffer.length()+1]; // Define a pointer to a char buffer called doc
std::strcpy (doc, buffer.c_str()); // Copy string buffer to char buffer caled doc

Serial.print("doc: ");Serial.println(String(doc)); // Print doc as string
// Do the joson stuff
StaticJsonDocument<1024> json;
Serial.println("deserialize !");

of course add this in a header file:
// strings and c-strings
#include
#include
#include

Cheers and greetings from the netherland.

Repeated lines

In ConfigOnSwitch example lines 299 to 310 are same as below.

No Networks Found in Scan

Hello, When the Configuration mode is set (by button), there is an message:
"WiFi scan found no networks. Restart configuration portalto scan again"
When SSID and Password is entered manually, it connects ok.
Btw. There are at least 4 WiFi networks working around in my case.
Tested on 1.0.2

And - Can you add some parametric settings to remove the unimportant text on "Information" page, please ?
I suggest to display ONLY the "Device Date" block. It is quite enough for nonexperienced user.

(And if you will make future changes, Change the "save" text button to "Save" )
Anyway - it is a GREAT tool !!
Jiri

COMPILING ERROR AFTER UPDATE

Please bear with as I'm Still learning. I am having an issue with this awesome library. I have a small sketch I am using and it works great but since I updated the library it is giving me this: Error compiling for broad NodeMCU 1.0 (ESP-12E Module). All I did was update the library and added the #define USE_LITTLEFS false to the sketch. Please help.
arduino 1.18.13
broad NodeMCU 1.0 (ESP-12E Module)

#define USE_LITTLEFS    false
#define USE_SPIFFS    true
#include <BlynkSimpleEsp8266_WM.h>
BlynkTimer timer;
unsigned int notified=0;

void notifiedtimer(){
 if (digitalRead(D2)==LOW && notified==1)
 {notified=0;}
}

void ledtimer(){
if (digitalRead(D2)==LOW && notified==0)
{Blynk.virtualWrite(V1,255);
Blynk.notify("MAILBOX OPENED");
Blynk.email("MAILBOX OPENED", "GO CHECK THE MAIL");
notified=1;
}
else if (digitalRead(D2)==HIGH && notified==1)
{Blynk.virtualWrite(V1,0);
notified=0;}
}
void setup() {  
pinMode(D2,INPUT_PULLUP);
Blynk.setConfigPortal("esp8266", "1234567890");
Blynk.begin("mail");
timer.setInterval(180000L,notifiedtimer);
timer.setInterval(500L,ledtimer);
}

void loop() {
  Blynk.run();
  timer.run(); 
}

Thanks!

Accessing manager after connection

Hi Khoi
I am experimenting with your WiFi Manager library on an ESP8266 and have been able to get it to successfully connect to my WiFi router.

According to the README.md file:

"The configuration portal will now be visible on two networks, these being it's own network and the network to which it has connected. On it's own network it will have two IP addresses, the original 192.168.4.1 and the same IP address it has on the network to which it connected."

Once connected to the router, I am not seeing the configuration port at either the 192.168.4.1 or the DHCP assigned IP address.
(I can successfully ping the DHCP assigned IP address but not the 192.198.4.1 address once the ESP8266 is connected.)

What am I missing?

Thanks, in advance.

Wifi Manager acts like Home Wifi Router?

Possible to make Wifi Manager always on? Such as any Wifi Router (TP-Link, etc) does.

So, we don't need to press reset button if want to check device info, change device name or change wifi credentials.

softAP with custom IP not working

Since I started digging in issues are pouring out :)

So sometimes softAP fires up with custom IP subnet settings other times with default 192.168.4.1.
in void ESP_WiFiManager::setupConfigPortal() function:

  if (_ap_static_ip)
  {
    LOGWARN(F("Custom AP IP/GW/Subnet"));
    LOGWARN2(_ap_static_ip, _ap_static_gw, _ap_static_sn);
    
    WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn);
  }

  delay(500); // Without delay I've seen the IP address blank
  
  LOGWARN1(F("AP IP address ="), WiFi.softAPIP());

and log print:

[WM] Custom AP IP/GW/Subnet
[WM] 192.168.10.1 192.168.10.1 255.255.255.0
[WM] AP IP address = 192.168.4.1
[WM] HTTP server started

so you can see i set them up correctly :) but not used ....... i was digging around a bit and got this "crude" solution:
espressif/arduino-esp32#985

so either:

WiFi.softAP(...);
wait for SYSTEM_EVENT_AP_START
WiFi.softAPConfig(...)

or:

WiFi.softAP(...);
delay(100);
WiFi.softAPConfig(...)

For now i went for the second "crude" bypass :) It works but i guess i will delay more because when i shut down debugging, print statement wont delay even more :)

Not Connecting

I get to the portal and select my wifi router but it just does not connect at all with a d1 mini esp8266

Document no-password config portal setup

First this is a huge improvement over the old WifiManager project. As I start learning all the new and improved features, I have one "why do it this way" request. I like WiFiManager features because it makes creating an IoT device for consumers easy. They power it up, and I can on a small note tell them how to connect to the initial portal (using a static AP name and IP address). From there, it's a simple configuration page and once done, "it just works". You don't even need the note as scanning for WiFi SSIDs with a high signal standing right at the unit should be pretty easy with the smallest of WiFi knowledge. Once you're connected, security is enabled and there's no longer an open SSID for the world to connect to.

My ESP8266s and ESP32 do not have a very long range. I don't fear people standing on the road by the house to be able to pick up the signal. Nor would they know AP or credentials, or credentials for internal services to enter for the internal configuration. It's a very limited and temporary portal.

Another way to handle this is using a phone app which has the password for the AP hard-coded. This is just as bad - it's easy to extract that from the binaries anyway - and would very soon be posted online anyway. So a brief insecure portal seems both easy and secure enough when we're talking about the initial setup.

But it looks like no password or null passwords are no longer allowed for the portal? If they are allowed, an example would be nice.

Again, this looks like something I needed months ago. Really looking forward to using the library for my small form-factor ESP8266ex and perhaps on ESP32s too.

Consult MultiWiFi

Hello my name is Jose, I am using the ESP_WiFiManager library in its latest version 1.20 and although everything works very well for my specific use, it would be better to be able to work with a single WIFI network, is there any configuration option that allows working exclusively with one NETWORK? At the moment what I am doing is using the library in version 1.011 in which MultiWiFi is not available
Since already very grateful for any suggestions

Feature Request! Firmware and Data (SPIFFS) update OTA and NTP Timezone

Hi Khoi,
It would be great if you include OTA update as well.
I think it should be separate from Wifi page.
So, after connected to local network, show different page for update and/or custom config.

I think it will be most complete starter library for ESP. Who doesn't want to be able to update over the air :) when you have wifi.

Maybe include ntp like NTP-TZ-DST.ino too. I think it should be basic features needed for every esp.

Cheers,
Sam

Image in Server

Good morning,

Very good this wifiManager. Is possible out one image.jpg in wifimanager? How can i send a image to WebServer?

Thank You,
Rodrigo Ribas

captive portal

hi sir

how can I add a captive portal for this library can you please help

link to platformio.ini file is broke

In order to run the WifiManager in Platformio various libraries need to be included. In my PIO installation DNSServer functions/methods are not found when the compiled parts are going to be linked together.
Building in release mode Linking .pio\build\pico32\firmware.elf .pio\build\pico32\src\main.cpp.o:(.literal._ZN15ESP_WiFiManager17setupConfigPortalEv+0x64): undefined reference to DNSServer::DNSServer()'
.pio\build\pico32\src\main.cpp.o:(.literal._ZN15ESP_WiFiManager17setupConfigPortalEv+0x68): undefined reference to DNSServer::setErrorReplyCode(DNSReplyCode const&)' .pio\build\pico32\src\main.cpp.o:(.literal._ZN15ESP_WiFiManager17setupConfigPortalEv+0x6c): undefined reference to DNSServer::start(unsigned short const&, String const&, IPAddress const&)'
.pio\build\pico32\src\main.cpp.o:(.literal.ZN15ESP_WiFiManager17startConfigPortalEPKcS1+0x24): undefined reference to DNSServer::stop()' .pio\build\pico32\src\main.cpp.o:(.literal._ZN15ESP_WiFiManager17startConfigPortalEPKcS1_+0x28): undefined reference to DNSServer::processNextRequest()'
.pio\build\pico32\src\main.cpp.o: In function ESP_WiFiManager::setupConfigPortal()': C:\Users\Uli\Documents\PlatformIO\Projects\ESP32_Wifimanager_Testing/.pio\libdeps\pico32\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:1457: undefined reference to DNSServer::DNSServer()'
C:\Users\Uli\Documents\PlatformIO\Projects\ESP32_Wifimanager_Testing/.pio\libdeps\pico32\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:1457: undefined reference to DNSServer::setErrorReplyCode(DNSReplyCode const&)' C:\Users\Uli\Documents\PlatformIO\Projects\ESP32_Wifimanager_Testing/.pio\libdeps\pico32\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:1457: undefined reference to DNSServer::start(unsigned short const&, String const&, IPAddress const&)'
.pio\build\pico32\src\main.cpp.o: In function ESP_WiFiManager::startConfigPortal(char const*, char const*)': C:\Users\Uli\Documents\PlatformIO\Projects\ESP32_Wifimanager_Testing/.pio\libdeps\pico32\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:1457: undefined reference to DNSServer::stop()'
C:\Users\Uli\Documents\PlatformIO\Projects\ESP32_Wifimanager_Testing/.pio\libdeps\pico32\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:1457: undefined reference to DNSServer::processNextRequest()' collect2.exe: error: ld returned 1 exit status *** [.pio\build\pico32\firmware.elf] Error 1

My assumption is that I have not included the DNSServer lib correctly into PIO.
It would help to see how it has to be defined in platformio.ini file, but the link to the example file lead to a 404 message.

Thx

Static Station IP doesn't work

When I try to set the static IP to the station, my router still assigns it a DHCP IP, how can I solve it? Thanks so much

void initAPConfig() {
  unsigned long startedAt = millis();

  ESP_WiFiManager ESP_wifiManager;
  ESP_wifiManager.setSTAStaticIPConfig(IPAddress(192, 168, 2, 114), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));

  Router_SSID = ESP_wifiManager.WiFi_SSID();
  Router_Pass = ESP_wifiManager.WiFi_Pass();

  Serial.println("Stored: SSID = " + Router_SSID + ", Pass = " + Router_Pass);
  ssid.toUpperCase();

  digitalWrite(LED_STATUS, LED_OFF); // Turn led off as we are not in configuration mode.

  startedAt = millis();
  if ( (WiFi.status() != WL_CONNECTED) && (millis() - startedAt < WIFI_CONNECT_TIMEOUT ) ) {
    WiFi.mode(WIFI_STA);
    WiFi.persistent (true);
    // We start by connecting to a WiFi network

    Serial.print("Connecting to ");
    Serial.println(Router_SSID);

    WiFi.begin(Router_SSID.c_str(), Router_Pass.c_str());

    int i = 0;
    if ((!WiFi.status() || WiFi.status() >= WL_DISCONNECTED) && i++ < WHILE_LOOP_STEPS) {
      delay(WHILE_LOOP_DELAY);
    }
  }

  Serial.print("After waiting ");
  Serial.print((millis() - startedAt) / 1000);
  Serial.print(" secs more in setup(), connection result is ");

  if (WiFi.status() == WL_CONNECTED) {
    Serial.print("connected. Local IP: ");
    Serial.println(WiFi.localIP());
  }
  else
    Serial.println(ESP_wifiManager.getStatus(WiFi.status()));
}

void startPortalConfigAP() {
  stopWatchdog();
  Serial.println("\nConfiguration portal requested.");
  digitalWrite(LED_STATUS, LED_ON); // turn the LED on by making the voltage LOW to tell us we are in configuration mode.

  //Local intialization. Once its business is done, there is no need to keep it around
  ESP_WiFiManager ESP_wifiManager;

  //Check if there is stored WiFi router/password credentials.
  //If not found, device will remain in configuration mode until switched off via webserver.
  Serial.print("Opening configuration portal. ");
  Router_SSID = ESP_wifiManager.WiFi_SSID();
  if (Router_SSID != "") {
    ESP_wifiManager.setConfigPortalTimeout(60); //If no access point name has been previously entered disable timeout.
    Serial.println("Got stored Credentials. Timeout 60s");
  }
  else
    Serial.println("No stored Credentials. No timeout");


  // Just a quick hint
  ESP_WMParameter p_hint("<small>*Hint: if you want to reuse the currently active WiFi credentials, leave SSID and Password fields empty</small>");
  ESP_WMParameter p_mqtt_server_label(mqtt_server_label, "MQTT SERVER", mqtt_server, 17);
  ESP_WMParameter p_mqtt_port_label(mqtt_port_label, "MQTT PORT", mqtt_port, 6);
  ESP_WMParameter p_mqtt_user_label(mqtt_user_label, "MQTT USER", mqtt_user, 18);
  ESP_WMParameter p_mqtt_password_label(mqtt_password_label, "MQTT PASSWORD", mqtt_password, 18);
  ESP_WMParameter p_mqtt_id_label(mqtt_id_label, "MQTT ID DEVICE", mqtt_id, 6);

  ESP_wifiManager.addParameter(&p_hint);
  ESP_wifiManager.addParameter(&p_mqtt_server_label);
  ESP_wifiManager.addParameter(&p_mqtt_port_label);
  ESP_wifiManager.addParameter(&p_mqtt_user_label);
  ESP_wifiManager.addParameter(&p_mqtt_password_label);
  ESP_wifiManager.addParameter(&p_mqtt_id_label);

  ESP_wifiManager.setSTAStaticIPConfig(IPAddress(192, 168, 2, 114), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));

  //it starts an access point
  //and goes into a blocking loop awaiting configuration
  if (!ESP_wifiManager.startConfigPortal((const char *) ssid.c_str(), password)) {
    Serial.println("Not connected to WiFi but continuing anyway.");
  }
  else {
    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");
  }

  strcpy(mqtt_server, p_mqtt_server_label.getValue());
  strcpy(mqtt_port, p_mqtt_port_label.getValue());
  strcpy(mqtt_user, p_mqtt_user_label.getValue());
  strcpy(mqtt_password, p_mqtt_password_label.getValue());
  strcpy(mqtt_id, p_mqtt_id_label.getValue());

  writeConfigFile();

  digitalWrite(LED_STATUS, LED_OFF); // Turn led off as we are not in configuration mode.
  initWatchdog();
}

hostname is not set

I would like to retain the original WiFi.hostname("MyHost") functionality of the original WiFi library.

In this library it seems not supported. The hostname is also showing up on my router as ESPblah. Having about 40 of these things in my house makes this difficult :)

Is there another way in your library to set the hostname?

Thanks for the efforts though. I like the double-reset.

Feature Request! Remove Config Portal Password from hardcode

Hi Khoih,

I would like to see the password for config portal to be able to set/update instead of hardcode.
Maybe if there is empty (first boot) ask to set portal password and also change password option and maybe when press Flash button on nodemcu (GPIO0 iirc) to clear password in case of forget (but someone can take over if he has access to the board. This maybe optional #define)

Cheers,
Sam

On Android phone ConfigPortal is unresponsive

Hello,

First i would like to thank you for the GREAT lib (I use it for my ESP-32 projects).

So off to the problem:

My SETUP function:

void WiFiSetup() {
  if (WiFi.getAutoConnect() == 0) { WiFi.setAutoConnect(1); }
  ESP_WiFiManager ESP_wifiManager("AAAAA");
#ifdef DEBUG_WIFI
  ESP_wifiManager.setDebugOutput(true);
#else
  ESP_wifiManager.setDebugOutput(false);
#endif
  ESP_wifiManager.setAPStaticIPConfig(IPAddress(192, 168, 10, 1), IPAddress(192, 168, 10, 1), IPAddress(255, 255, 255, 0));
  ESP_wifiManager.setMinimumSignalQuality(38);                                                     //38% = -81
  Router_SSID = ESP_wifiManager.WiFi_SSID();
  Router_Pass = ESP_wifiManager.WiFi_Pass();

#ifdef DEBUG_WIFI_CREDENTIALS
  Serial.println("    Stored: SSID = " + Router_SSID + ", Pass = " + Router_Pass);
#endif

  String AP_SSID = "xxxxxx";
  String AP_PASS = "zzzzzzzzzzz";

  if (Router_SSID != "") {
    WiFi.mode(WIFI_STA);
    WiFi.begin();
    byte _i = 0;
    while(!WiFi.isConnected() && _i < 100) {
      _i++;
      delay(100);
    }
    if (WiFi.isConnected()) {
#ifdef DEBUG_WIFI
      Serial.println("    WiFi OK!");
#endif
    } else {
#ifdef DEBUG_WIFI
      Serial.println("    WiFi NOT connected! Config portal and AP! 120s Timeout");
#endif
      ESP_wifiManager.setConfigPortalTimeout(120);
      ESP_wifiManager.autoConnect(AP_SSID.c_str(), AP_PASS.c_str());
    }
  } else {

#ifdef DEBUG_WIFI
    Serial.println("     No stored Credentials. 120s timeout");
#endif
    ESP_wifiManager.setConfigPortalTimeout(120);
    ESP_wifiManager.autoConnect(AP_SSID.c_str(), AP_PASS.c_str());
  }
}

and when i have no credentials stored it starts ConfPortal BUT the problem is that when i try accessing it from my Note10+ (Chrome or builtin browser and latest fw) page takes AGES to load (more than 5 mins or it doesnt at all) from PC (Chrome browser, win 10) it works as should.

sometimes i get back error in Serial monitor other times i dont: [E][WebServer.cpp:617] _handleRequest(): request handler not found
and usually after a few refreshes it loads the page quite quickly :)

is there any idea what is going on? and mainly how to solve it?
I was thinking that i might have messed some of config part? like IP addresses (had to change it as one of my networks i connect over VPN is 192.168.4.x)

There is also a question i would like to ask ...... is there a way i can change the portal html code? i would like to use one that suits me more? Or perhaps if that part of the code could be a separate file so it would be easy to change it (just a hint perhaps for some future updates) :) and perhaps not being affected when you update your lib (or at least just being able to copy html related files over and you are done :) )?

BR
Ales

EDIT: like email :) when I click send, I remember to attach file :) so the file here is .... after portal is loaded if i click on any button .... we start from beginning no page loaded ..... need to refresh a few times and then it starts working or i need to wait a minute or a few :)

get local ip address

Hi,
just trying out your library, which looks very promising. I am running into a weird problem, to receive my ip address after it is connected to an network.

code:

IPAddress ip;
ip = WiFi.localIP();

but I am getting this exception:

WiFi connected
HHGuru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400014fd  PS      : 0x00060430  A0      : 0x800ded18  A1      : 0x3ffb1f30  
A2      : 0xab41b9a4  A3      : 0xab41b9a0  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ffb1ed0  
A10     : 0x00000001  A11     : 0x0d400000  A12     : 0x00000005  A13     : 0x00000020  
A14     : 0x00000020  A15     : 0x3ffb0060  SAR     : 0x00000005  EXCCAUSE: 0x0000001c  
EXCVADDR: 0xab41b9a4  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

Backtrace: 0x400014fd:0x3ffb1f30 0x400ded15:0x3ffb1f40 0x400deda1:0x3ffb1f60 0x400d176f:0x3ffb1f80 0x400e0025:0x3ffb1fb0 0x40089051:0x3ffb1fd0

Rebooting...

Any idea why this is happening? Running latest version of Arduino and your library.

Thanks,
bert

Which SPIFFS.h?

There are so many SPIFFS libraries, which one should we use for your WifiManager?

ESP32 Wroom not working with library?

Greetings!

Tried your library, works great with ESP32 Wroover-B. But when I try to upload the same sketch to the board from the ESP32 Wroom, everything stops working.
I manually turn on the configuration server - a network appears, I connect to it, configure the access point. In the serial port, I see the local address 255.255.255.0
Accordingly, there is no internet connection.

Again, everything works great on the first board with ESP32 Wroover-B!

What could be the reason for this behavior?

Thanks in advance!

Stationmode Static IP changes to dhcp when esp8266 is restarted

#include <DNSServer.h>            //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h>     //Local WebServer used to serve the configuration portal
#include <ESP_WiFiManager.h> //Configuration Magic
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
// Force DHCP to be true
#if defined(USE_DHCP_IP)
#undef USE_DHCP_IP
#endif
#define USE_DHCP_IP     true
#else
// You can select DHCP or Static IP here
#define USE_DHCP_IP     false
#endif

#define USE_CONFIGURABLE_DNS      false
WiFiUDP Udp;
ESP_WiFiManager wifiManager;

unsigned int localUdpPort = 5000;
char incomingPacket[256];
char replyPacket[] = "color recieved";

void setup()
{
  Serial.begin(9600);
  Serial.println();

  
  wifiManager.setSTAStaticIPConfig(IPAddress(192,168,43,69),IPAddress(192,168,43,1),IPAddress(255, 255, 255, 0));
if (!wifiManager.autoConnect("rgbTower", "S1o2m3u4@")) {
    Serial.println("failed to connect, we should reset as see if it connects");
    delay(3000);
    ESP.reset();
    delay(5000);
  }

  Serial.println(" connected");

  Udp.begin(localUdpPort);
  Serial.printf("Now listening at IP %s, UDP port %d\n", WiFi.localIP().toString().c_str(), localUdpPort);
}


void loop()
{
  int packetSize = Udp.parsePacket();
  if (packetSize)
  {
    // receive incoming UDP packets
    Serial.printf("Received %d bytes from %s, port %d\n", packetSize, Udp.remoteIP().toString().c_str(), Udp.remotePort());
    int len = Udp.read(incomingPacket, 255);
    if (len > 0)
    {
      incomingPacket[len] = 0;
    }
    Serial.printf("UDP packet contents: %s\n", incomingPacket);

    // send back a reply, to the IP address and port we got the packet from
    Udp.beginPacket(Udp.remoteIP(), 5000);
    Udp.write(replyPacket);
    Udp.endPacket();
  }
} 

im very new to arduino and stuff, i made a code but i'm unable to keep the static IP persistent. it changes to dhcp as soon as i restart the esp. please correct me if i'm doing something wrong.

ESP_WiFiManager-Impl.h comment trailing backslash breaks compilation

System: Linux Mint 20 Ulyana
Arduino IDE: 1.8.13
Card: Heltec Wifi LoRa32 v2.1
Revision: recents
File: ESP_WiFiManager/src/ESP_WiFiManager-Impl.h
Method: ESP_WiFiManager::connectWifi
Line: 713

Hello KH,
the trailing (continuation) backslash at the end of this comment line
breaks the compilation, removing it and all goes well.

Hide or turn off SSID1 and PASSWORD1 field

Hello there
Is there any way to disable fields for SSID1 and PASSWORD1? I wont be using MultiWiFi feature
I succesfully disabled USE_STATIC_IP_CONFIG_IN_CP but i cant do the same for SSID1 and PASSWORD1

Configuration

No connection on a wifi with a hidden SSID

Describe the bug

I compiled the example ConfigPortalParamsOnSwitch and tried to connect to a wifi network with a hidden SSID. I was able to start the configuration portal and enter the credentials of the wifi network. The data is stored and the device reboots. But it didn't connect to the wifi.
If I reconfigure the wifi to show the SSID, the device connects to it. But after switching back to hidden SSID and reboot of the device, I got no connection.

Steps to Reproduce

  • Configure a wifi that has a hidden SSID.
  • Compile the example ConfigPortalParamsOnSwitch.
  • Start the configuration portal.
  • Enter the credentials (ssid and password) manually.
  • Reboot the device.

Expected behavior

The device should connect to wifi networks having a hidden SSID.

Actual behavior

The device tries to connect to the wifi network having a hidden SSID, but it got no connection.

Debug and AT-command log (if applicable)

Starting ConfigPortalParamsOnSwitch using LittleFS on ESP32_DEV
ESP_WiFiManager v1.5.1
Configuration file not found
Failed to read configuration file, using default values
[WM] RFC925 Hostname = ConfigPortalParamsOnSW
[WM] setAPStaticIPConfig
[WM] setSTAStaticIPConfig
[WM] Set CORS Header to :  Your Access-Control-Allow-Origin
ESP Self-Stored: SSID = <my_ssid>, Pass = <my_password>
[WM] * Add SSID =  <my_ssid> , PW =  <my_password>
Got ESP Self-Stored Credentials. Timeout 120s for Config Portal
[WM] LoadWiFiCfgFile 
[WM] OK
[WM] stationIP = 10.12.333.27 , gatewayIP = 10.12.333.1
[WM] netMask = 255.255.255.0
[WM] dns1IP = 192.168.2.1 , dns2IP = 8.8.8.8
[WM] * Add SSID =  <my_ssid> , PW =  <my_password>
ConnectMultiWiFi in setup
[WM] ConnectMultiWiFi with :
[WM] * Flash-stored Router_SSID =  <my_ssid> , Router_Pass =  <my_password>
[WM] * Additional SSID =  <my_ssid> , PW =  <my_password>
[WM] Connecting MultiWifi...

And after some time looping...

[WM] WiFi not connected
F
WiFi lost. Call connectMultiWiFi in loop
[WM] ConnectMultiWiFi with :
[WM] * Flash-stored Router_SSID =  <my_ssid> , Router_Pass =  <my_password>
[WM] * Additional SSID =  <my_ssid> , PW =  <my_password>
[WM] Connecting MultiWifi...
[WM] WiFi not connected
F
WiFi lost. Call connectMultiWiFi in loop
[WM] ConnectMultiWiFi with :
[WM] * Flash-stored Router_SSID =  <my_ssid> , Router_Pass =  <my_password>
[WM] * Additional SSID =  <my_ssid> , PW =  <my_password>
[WM] Connecting MultiWifi...

Information

Arduino IDE version: 2.0.0-beta.3
ESP32 Core Version 1.0.6
ESP_WiFiManager 1.5.1
Boards: NodeMCU ESP-325 v1.1 (ESP-WROOM-32) / DOIT Esp32 DevKit v1

Not able to read analog port when using the autoconnect example

Hello,

Sorry to bother you with probably a beginners mistake and thank you for creating such a great library.

Issue is the following:
When I compile and run the autoconnect.ino, things run smoothly.

When I'm adding the simple code to read an analog pin (eg pin 12) it always returns 4095. I understand that when the pin is not connected this value should fluctuate but it stays constant.

I'll attach the example.
I'm using an esp32-wroom-32d on max osx

Thank you for your respond

Maurice

org_autoconnect2.txt

reconnectWifi misusage of connectWifi

System: Linux Mint 20 Ulyana
Arduino IDE: 1.8.13
Card: Heltec Wifi LoRa32 v2.1
Revision: recents
File: ESP_WiFiManager/src/ESP_WiFiManager-Impl.h
Method: ESP_WiFiManager::reconnectWifi
Lines: 690,694

Hello KH,
the type of the method connectWifi is "int",
in the method reconnectWifi, "connectResult" have type "bool".
my suggestions :

  • change "bool connectResult" to "int connectResult"
  • change return code from "return connectResult" to "return connectResult == WL_CONNECTED"

PlatformIO - 'WiFiClient' does not name a type

Hi,

I'm using your library in PlatformIO for the first time. Never had problem with Arduino IDE.
In Platform I have library added ( khoih-prog/ESP_WiFiManager@^1.2.0),

When I try compile a black project with your includes in, I get the error below.
How would I solve this?

ompiling .pio\build\esp32doit-devkit-v1\liba2a\WiFi\WiFiGeneric.cpp.o In file included from src\WiFi.cpp:1:0: .pio/libdeps/esp32doit-devkit-v1/ESP_DoubleResetDetector/src/ESP_DoubleResetDetector.h:38:2: warning: #warning Neither EEPROM nor SPIFFS selected. Default to EEPROM [-Wcpp] #warning Neither EEPROM nor SPIFFS selected. Default to EEPROM ^ In file included from .pio/libdeps/esp32doit-devkit-v1/ESP_WifiManager/src/ESP_WiFiManager.h:51:0, from src\WiFi.cpp:2: C:/users/crispin/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:97:11: error: 'WiFiClient' does not name a type virtual WiFiClient client() { return _currentClient; }

Info about the html code

hello, thanks for the library, but if i want to change the portal html, or make it accessible also after connected to the wifi, how and where can i change it? it's so noce, compile the sketch and it works....but where is the real code? thank you again!

Config Portal MQTT parameters

First of all thanks once again for your ever-inspiring work..

One quick question: I am trying your mqtt examples and, although I see you set the parameters in the config portal (AIO_), the possibility to change these does NOT appear on the config portal.

What am I doing wrong?

Strange IP Address from ConfigPortalParamsOnSwitch

I have been testing your wonderful script (ConfigPortalParamsOnSwitch)

All works well except for that fact that it always gets a IP Address of 192.168.2.224 when my network (and my DHCP) work on the 192.168.0.XXX Range.

15:46:20.750 -> Starting
15:46:20.853 -> {"PortalSSID":"Device123","PortalPassword":"12345678"}
15:46:20.853 -> Config file was successfully parsed
15:46:20.921 -> Stored: SSID = FASTWEB, Pass = f3rd12oo3
15:46:20.955 -> Connecting to FASTWEB
15:46:21.126 -> After waiting 0 secs more in setup(), connection result is connected. Local IP: 192.168.2.224
15:46:21.160 -> HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHH

Because of this I am unable to use script for further connections. I need to open a TCP Port to a server on my network at address 192.168.0.234 and, obviously if the ESP32 takes an address of 192.168.2.224 it will never succeed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.