@Roffey there s absolutely nothing wrong with using eeprom for storing user/pass, but as you mentioned, the esp core is already doing that. I ve just streamlined WiFiManager to have one less dependency (eeprom) and saves a write on config. Basically trying to keep it as simple as possible and to use what s already there.
@tzapulica Brilliant work, Alex!!! This is so much better than my own feeble attempt. Thank you.
@janjansen47 Whah???
is it possible to add WiFiManager sample sketch and connect the ESP-12E to Blynk Cloud in same time , i mean
one sketch has both WIFIManager and Blynk_standalone together.
@chrome1000 thank you very much for your kind words
@scropion86 sure, see my blynk enabled sketch here
it was also somewhere on this forumā¦
all you need to do is really
//connect
wifi.autoConnect("Blynk");
//config blynk
Blynk.config(auth);
First off a big thanks to the community. Iāve been researching options to build a wifi connected sensor network and all the information on this forum has really helped a lot.
@tzapulica
Iāve been delving deep into your wifimanager code to add some sort of AP config functionality. I absolutely love the captive portal functionality and it is exactly what Iām looking for. Iāve been using arduino for a couple of years now but I would still consider myself a novice when it comes to code. Iāve tried to understand and implement your sprinkler relay code into my own project but Im really confused wich part of the code adds the AP functionality.
If itās not too much trouble, can you show me how you would use the wifi.autoconnect in the standard esp8266 standalone example from the blynk library? Any help is greatly appreciated and keep up the good work.
hi @tjookum
in the any esp arduino app, including blynk examples you should do the following
include headers
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
in setup() function after the serial init code but before any blynk stuff add
WiFiManager wifiManager;
wifiManager.autoConnect("AutoConnectAP");
Blynk.config("blynk_project_key"); //instead of the blynk connect stuff in the example
Hope this helps
Thank you! For a novice like me a little help like this goes a long way.
Iāll try it out and report back with my findings.
Iād recommend using the 1.6.5. In my opinion that is the most stable. I have no idea what they did to the latest version, but it doesnāt seem to work properly all the time.
@chrome1000 @moch.effendi the latest WiFiManager has the ability to add custom parameters and there s an example to save as many extra parameters are you want to FS/SPIFFS
@tzapulica how to call parameters : Blynk.begin(blynk_token) or Blynk.config(blynk_token) ?
if used Blynk.begin(blynk_token) cant compile
Arduino: 1.6.5 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Serial, 115200, 4M (3M SPIFFS)"
ESP12EAutoConnectWithFSParameters.ino: In function 'void setup()':
ESP12EAutoConnectWithFSParameters:136: error: no matching function for call to 'BlynkWifi::begin(const char*&)'
ESP12EAutoConnectWithFSParameters.ino:136:26: note: candidates are:
In file included from ESP12EAutoConnectWithFSParameters.ino:9:0:
C:\Users\mocha\OneDrive\Dokumen\Arduino\libraries\Blynk/BlynkSimpleEsp8266.h:65:10: note: void BlynkWifi::begin(const char*, const char*, const char*, const char*, uint16_t)
void begin(const char* auth,
^
C:\Users\mocha\OneDrive\Dokumen\Arduino\libraries\Blynk/BlynkSimpleEsp8266.h:65:10: note: candidate expects 5 arguments, 1 provided
C:\Users\mocha\OneDrive\Dokumen\Arduino\libraries\Blynk/BlynkSimpleEsp8266.h:75:10: note: void BlynkWifi::begin(const char*, const char*, const char*, IPAddress, uint16_t)
void begin(const char* auth,
^
C:\Users\mocha\OneDrive\Dokumen\Arduino\libraries\Blynk/BlynkSimpleEsp8266.h:75:10: note: candidate expects 5 arguments, 1 provided
no matching function for call to 'BlynkWifi::begin(const char*&)'
hi
you just do
//config blynk
Blynk.config(auth);
and the guys here at blynk were nice enough to make it auto connect at the first
//blynk connect and run loop
Blynk.run();
in loop()
see example here https://github.com/tzapu/BlynkSprinklerRelay/blob/master/BlynkSprinklerRelay.ino
@tzapulica,
Iām trying out your code and I canāt get even the simplest program to compile. Here is where I am.
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
void setup() {
// put your setup code here, to run once:
WiFiManager wifiManager;
wifiManager.autoConnect("Connect");
}
void loop() {
// put your main code here, to run repeatedly:
}
Here are the errors:
In file included from C:\Users\cad\Documents\Arduino\Wifi Connect\sketch_jan20b\sketch_jan20b.ino:2:0:
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:80:3: error: 'WiFiClient' does not name a type
WiFiClient client() { return _currentClient; }
^
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:127:22: error: 'WiFiClient' has not been declared
bool _parseRequest(WiFiClient& client);
^
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:130:19: error: 'WiFiClient' has not been declared
bool _parseForm(WiFiClient& client, String boundary, uint32_t len);
^
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:133:27: error: 'WiFiClient' has not been declared
uint8_t _uploadReadByte(WiFiClient& client);
^
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:143:3: error: 'WiFiServer' does not name a type
WiFiServer _server;
^
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:145:3: error: 'WiFiClient' does not name a type
WiFiClient _currentClient;
^
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h: In member function 'size_t ESP8266WebServer::streamFile(T&, const String&)':
C:\Users\cad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:121:10: error: '_currentClient' was not declared in this scope
return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE);
^
exit status 1
Error compiling.
hi @Stevie , that looks like a very weird error, like some part of your esp8266 core is missing, could you reinstall it all?
cheers
Ok @tzapulica,
I had Arduino 1.6.7 installed. After some reading I decided it was best to downgrade to 1.6.5 soā¦
- Uninstalled Arduino 1.6.7
- Installed Arduino 1.6.5
- Re-installed the ESP8266 core via adding http://arduino.esp8266.com/stable/package_esp8266com_index.json to the preferences
- Version 0.6.0 of WifiManager installed via a new github download
Here are the errors iām getting now from the āAutoConnectā example program:
C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp: In member function 'void WiFiManager::handleWifiSave()':
C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:462:20: error: 'class IPAddress' has no member named 'fromString'
_sta_static_ip.fromString(server->arg("ip"));
^
C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:467:20: error: 'class IPAddress' has no member named 'fromString'
_sta_static_gw.fromString(server->arg("gw"));
^
C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:472:20: error: 'class IPAddress' has no member named 'fromString'
_sta_static_sn.fromString(server->arg("sn"));
^
Error compiling.
If i downgrade the esp8266 core to 1.6.5-947 here are the errors I get:
C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp: In member function 'String WiFiManager::getPassword()': C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:210:18: error: 'class ESP8266WiFiClass' has no member named 'psk' _pass = WiFi.psk(); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp: In member function 'void WiFiManager::handleRoot()': C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:305:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_SCRIPT); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:306:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_STYLE); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:307:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_HEAD_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:317:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_PORTAL_OPTIONS); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:318:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp: In member function 'void WiFiManager::handleWifi(boolean)': C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:335:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_SCRIPT); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:336:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_STYLE); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:337:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_HEAD_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:354:40: error: 'FPSTR' was not declared in this scope String item = FPSTR(HTTP_ITEM); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:376:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_FORM_START); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:384:41: error: 'FPSTR' was not declared in this scope String pitem = FPSTR(HTTP_FORM_PARAM); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:395:13: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P("<br/>"); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:400:40: error: 'FPSTR' was not declared in this scope String item = FPSTR(HTTP_FORM_PARAM); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:405:40: error: 'class IPAddress' has no member named 'toString' item.replace("{v}", _sta_static_ip.toString()); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:414:40: error: 'class IPAddress' has no member named 'toString' item.replace("{v}", _sta_static_gw.toString()); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:423:40: error: 'class IPAddress' has no member named 'toString' item.replace("{v}", _sta_static_sn.toString()); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:427:13: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P("<br/>"); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:430:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_FORM_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:431:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp: In member function 'void WiFiManager::handleWifiSave()': C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:462:20: error: 'class IPAddress' has no member named 'fromString' _sta_static_ip.fromString(server->arg("ip")); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:467:20: error: 'class IPAddress' has no member named 'fromString' _sta_static_gw.fromString(server->arg("gw")); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:472:20: error: 'class IPAddress' has no member named 'fromString' _sta_static_sn.fromString(server->arg("sn")); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:484:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_SCRIPT); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:485:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_STYLE); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:486:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_HEAD_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:488:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_SAVED); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:490:11: error: 'class ESP8266WebServer' has no member named 'sendContent_P' server->sendContent_P(HTTP_END); ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp: In member function 'boolean WiFiManager::captivePortal()': C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:531:21: error: 'class ESP8266WebServer' has no member named 'hostHeader' if (!isIp(server->hostHeader()) ) { ^ C:\Users\cad\Documents\Arduino\libraries\WiFiManager-master\WiFiManager.cpp:533:84: error: 'class WiFiClient' has no member named 'localIP' server->sendHeader("Location", String("http://") + toStringIp(server->client().localIP()), true); ^ Error compiling.
I have sucessfully compiled and uploaded the āAutoconnectā example code, modifying it to run Blynk, but when I try to use the āAutoConnectWithFSParametersā example, the sketch compiles and uploads, but Iām getting a watchdog timer reset when it attempts to read the file system (possibly at the SPIFFS.begin(); line because I see the Serial data from the line above the SPIFFS line works).
Can anyone point me in the right direction as to what Iām doing wrong. Iāll post up the code, but it is just the example copied directly, with the Blynk.config() and Blynk.run() lines added to try to get Blynk going.
Any help would be greatly appreciated.
Hi
Try a SPIFFS.format() before begin