Closed HamzaHajeir closed 3 years ago
Try to use https://github.com/alanswx/ESPAsyncWiFiManager ...
Thanks @Pablo2048
It works 👍
The library mentioned in the link above is a mess. Is there any word of a compatible library or method to use a captive portal wifi manager with this lib?
You are free to made better one, or you can help Alan to made his "mess" better...
It's not a matter of better, it's a matter of a derivative art correctly showing it's provenance. It's "legal" because of the original licensing, but it's rude. It also prevents one from easily merging in any improvements from the original. Finally, and perhaps worse, the instructions he's left on the project are verbatim from the original. If someone were to follow them they would end up getting the original art without any idea why it was not working with the Async libraries.
Anyone is always free to roll their own, however, the strength of the ecosystem is a library of maintained, common code available for reuse in other projects. Dead-ends lead to death.
I'm not sure I have time to fix his work, my interests lie in the core project with which I am working, not fixing someone else's project. I guess I have decisions to make in that case.
Well, you have to write a note to Alan first instead of all of this IMO. Strength of the ecosystem is in maintained libraries, but if everybody has "interests in the core project ... not fixing someone else's project" then there would be no libraries at all.
I absolutely do not have to write a note to Alan. His very first Issue #1 Curious but not forked was about this and he's chosen not to do anything about it since July 4, 2016. Odds are a "note" from me will not change things.
And your last comment is myopic as well. Clearly, some people's core projects ARE those libraries that they maintain and from which we all benefit.
"All this" is you objecting to me calling his work a mess. The core question I posed was the existence of a library that worked with this project to present a captive wifi configuration portal. Apparently, the only two which exist are dead-end projects with no provenance and no courtesy given to the prior art. I choose not to use those, so I'll head a different way.
"Mess" or not, I understand it works, so in lieu of anything 'better' or less 'messy', it is the best around and I will use it.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
I am still very interested in adding WiFiManager (or similar) support to this project.
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
@lbussy Check ESPArto Framework
You can find your interests there.
Thank you @HamzaHajeir, I'll have a look.
I think the original ask is still valid however. If one has an existing project, having a library change is easier than rebuilding on a new framework. There might be something there I can easily leverage.
@lbussy That's right.
I've spent time converting a project to ESPArto.
You can consider it for upcoming projects.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Still an issue, despite the bot's best intention.
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If anyone is curious (or masochistic) I forked WiFiManager and made it work with ESPAsyncWebServer.
If you want to use it, fork it, please. Right now I'm not intending to take issues anyone else may hit. "It Works for Me™."
After reflection, this issue would be best raised in WiFiManager, so I'll refrain from arguing with Stale Bot anymore.
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
I have this problem too, any solution ?
Hello
I've tried to use both AsyncTCP and WiFiManager at one sketch, but got many errors.
I guess it comes because of libraries overlapping, I am not sure .
I wonder to know how to use both libraries at one sketch ?
Header files included :
#include <ESP8266WiFi.h> #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> #include <stdio.h> #include <malloc.h> #include <string> #include <Arduino.h> #include <Hash.h> #include <ESPAsyncTCP.h> #include <ESPAsyncWebServer.h> #include "ArduinoJson.h"
Error :
Arduino: 1.8.7 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, 4M (3M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200" In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:56:18: error: redeclaration of 'HTTP_GET' HTTP_GET = 0b00000001, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:29: note: previous declaration 'HTTPMethod HTTP_GET' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:57:18: error: redeclaration of 'HTTP_POST' HTTP_POST = 0b00000010, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:39: note: previous declaration 'HTTPMethod HTTP_POST' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:58:18: error: redeclaration of 'HTTP_DELETE' HTTP_DELETE = 0b00000100, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:72: note: previous declaration 'HTTPMethod HTTP_DELETE' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:59:18: error: redeclaration of 'HTTP_PUT' HTTP_PUT = 0b00001000, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:50: note: previous declaration 'HTTPMethod HTTP_PUT' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:60:18: error: redeclaration of 'HTTP_PATCH' HTTP_PATCH = 0b00010000, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:60: note: previous declaration 'HTTPMethod HTTP_PATCH' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:61:18: error: 'HTTP_HEAD' redeclared as different kind of symbol HTTP_HEAD = 0b00100000, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:9:0: C:\Users\Hamza\Documents\Arduino\libraries\WiFiManager/WiFiManager.h:25:12: error: previous declaration of 'const char HTTP_HEAD [143]' const char HTTP_HEAD[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/><title>{v}</title>"; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:62:18: error: redeclaration of 'HTTP_OPTIONS' HTTP_OPTIONS = 0b01000000, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:85: note: previous declaration 'HTTPMethod HTTP_OPTIONS' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:16:0: C:\Users\Hamza\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:63:18: error: redeclaration of 'HTTP_ANY' HTTP_ANY = 0b01111111, ^ In file included from C:\Users\Hamza\Desktop\Programming developments\PlayColor Arduino\AsyncTCP___AsyncJson___WiFiManager\AsyncTCP___AsyncJson___WiFiManager.ino:8:0: C:\Users\Hamza\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer\src/ESP8266WebServer.h:31:19: note: previous declaration 'HTTPMethod HTTP_ANY' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module). This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
ESP8266WebServer
hi . Workbench on a single platform name only one is ESPAsyncWebServer or ESP8266WebServer
Hi! Faced the same problem, but analysis of the code showed that if the WEBSERVER_H directive is declared, then HTTP_GET is ignored ...
#ifndef WEBSERVER_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,
} WebRequestMethod;
#endif
Therefore, to solve the problem, you need to do the following in your code:
#include "WiFiManager.h"
WiFiManager wifiManager;
#define WEBSERVER_H
#include "ESPAsyncWebServer.h"
I tried the @egrekov solution, it works. The problem caused by conflicting between ESPAsyncWebServer and ESP8266WebServer libraries. In order to solve it, we just need to define WEBSERVER_H
before import ESPAsyncWebServer lib
I have used both with success before. You just have to use different ports for each of them. So if ESPAsynchWebserver uses 8080 then WifiManager has to use different such as 80. But for my uses case WifiManager did not fit. So I created mymown WifiManager with smashing success. I was happy with it and beast part ESPAsynchWebserever runs in tandem with it. The ESP goes into AP mode while ESPAsynchWebserver not yet activated. Key is make a while loop in setup while user is punching in the passwordnusername.
Sent from Yahoo Mail for iPhone
On Saturday, August 15, 2020, 10:17 AM, xuanloct4 notifications@github.com wrote:
I tried the @egrekov solution, it works. The problem caused by conflicting between ESPAsyncWebServer and ESP8266WebServer libraries. In order to solve it, we just need to define WEBSERVER_H
before import ESPAsyncWebServer lib
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@gibo77 The problem is not in the same ports, the fact is that two libraries define the same types, which leads to a compilation error, but the authors of ESPAsynchWebserever
provided a solution to this problem.
PS. It would be nice if it was described in the documentation.
the authors of
ESPAsynchWebserever
provided a solution to this problem.
@gibo77 - link please?
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
@lbussy ESPAsyncWebServer.h#60
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
I think the time has came to close this issue, As it seems to me.
Hello a big THANK to egrekov
before import ESPAsyncWebServer lib
fixed my issue Regards,
egrekov
Instead of just defining WEBSERVER_H
I had to include the whole "Webserver.h" before the ESPAsyncWebServer to resolve my issuess:
// #define WEBSERVER_H
#include "WebServer.h"
#include <ESPAsyncWebServer.h>
@egrekov Oh god you're my life saver ! I just opened an issue and it cost me two hours of struggle to finally see the solution. Thanks a lot. It would be great to update the library documentation to prevent these kind of issues.
Defining WiFiManager.h at the top of my file solved the problem for me
#include "WiFiManager.h"
WiFiManager wifiManager;
#define WEBSERVER_H
#include "ESPAsyncWebServer.h"
// My other libs used
#include <PubSubClient.h>
#include <WiFiClientSecure.h>
Hello everyone,
Thank you for the provided solutions.
Regrettably, I have encountered situations where these solutions do not work. An example is when utilizing the "HTTP_PUT" or "HTTP_DELETE" methods. These methods have different values; for instance, in "WebServer" (esp32), "HTTP_PUT" has a value of 4, whereas in "ESPAsyncWebServer," it has a value of 0b00001000 (8). Similarly, "HTTP_DELETE" in "WebServer" has a value of 0, but in "ESPAsyncWebServer," it is 0b00000100 (4). On the other hand, the "HTTP_GET" method has a consistent value of 1 for both "WebServer" and "ESPAsyncWebServer."
This discrepancy leads to an issue where registering two functions for "HTTP_DELETE" and "HTTP_PUT" methods may result in unexpected behavior. If a request with the "PUT" method is made from the browser, the application will call the function registered for the "HTTP_DELETE" method. This occurs because our application uses methods from "WebServer", and the internal logic of "ESPAsyncWebServer" lacks the definition of "WEBSERVER_H," causing it to use the original values from "WebRequestMethod" enum in "ESPAsyncWebServer.h".
Has anyone discovered a workaround to address this issue?
Best Regards,
Hello
I've tried to use both AsyncTCP and WiFiManager at one sketch, but got many errors.
I guess it comes because of libraries overlapping, I am not sure .
I wonder to know how to use both libraries at one sketch ?
Header files included :
Error :