Hey guys so i came across this amazing library - AutoConnect and wanted to share it with the blynk community!
Its feature packed!
Stores SSID and Password so no need to hard code them in the sketch
Custom WebPage for blynk server (No need to hard code blynk server details)
Blynk Custom WebPage Supports both local and cloud server (No need to upload sketch everytime to change blynk credentials)
To use Blynk Cloud enter port as 80 and the IP address from pinging “blynk-cloud.com”.
Unlike WifiManager library the portal can be accessed even when the device is connected to WiFi making it possible to modify credentials for blynk or reconnect to another WiFi network!
(Connect by typing the ip assigned to the device)
I have already made an example ready to go, just download and upload it to your device and connect to blynk without any modification in the sketch! It stores all value in SPIFFS and thus all configuration survives reboot.
Yes you did get all the points right, its really similar to Blynk.inject!
As far my knowledge with Blynk.inject, with the enterprise app, i guess the WiFi can be changed, infact i remember it working exactly like this library but just within the application instead of a browser window. I am not sure though.
Thank you for sharing this. I was really looking for something like this to integrate Blynk with simple web page for informational purposes as in my project not all parameters read from device are transferred to Blynk Server, and it seems this library makes it really easy. Great!
Here is a snippet of what I do for connection management at start up. All the user has to do is enter wifi credentials, the system will call out for an auth token from one of my webservers if the user leaves it blank.
// Check to see if we have a configured SSID. If we do, use it.
if (WiFi.SSID() != "")
{
MYDEBUG_PRINTLN("SSID Configured, connect to it.");
display.println("Connecting to WiFi...");
display.display();
WiFi.mode(WIFI_STA);
WiFi.begin();
int loop = 10;
while ((WiFi.status() != WL_CONNECTED) && (loop > 0))
{
delay(500);
MYDEBUG_PRINT(".");
loop--;
}
}
else
{
MYDEBUG_PRINTLN("No SSID Configured, start configuration portal");
display.println("Device not configured");
display.println("");
display.print("AP:");
display.println(" ESP_" + mac);
display.display();
// WiFi hasn't been configured, fire up the config interface.
WiFiManager wifiManager;
//set config save notify callback
wifiManager.setSaveConfigCallback(saveConfigCallback);
wifiManager.addParameter(&custom_blynk_text);
wifiManager.addParameter(&custom_token);
wifiManager.addParameter(&custom_blynk_server);
wifiManager.addParameter(&custom_blynk_port);
// Set the connect timeout to 2 minutes
wifiManager.setTimeout(120);
String hname = "ESP_";
hname.concat(mac);
if (!wifiManager.autoConnect((const char*)hname.c_str())) {
// If we timeout here it is because we did not receive a configuration from the portal
// The device will have to be reset to try again
MYDEBUG_PRINTLN("WifiManager config timeout.");
WiFi.printDiag(Serial);
}
}