[GH-ISSUE #1387] ESPAlexa - WiFiManager incompatibility #1190

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

Originally created by @GoTVm on GitHub (Apr 8, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1387

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32: ESP8266

Hardware: ESP-12e

Core Version: 2.4.0

Description

WiFiManager interferes with ESPAlexa because they both use a WebServer. This could be fixed by passing the webserver WiFiManager is using to ESPAlexa, but I can't seem to find where it creates it so as to pass it as a parameter. Therefore I'm wondering if there is any workaround so I can implement this into my ESPAlexa sketch.

Settings in IDE

Module: NodeMcu

Additional libraries:
ESPAlexa.h

Sketch

#BEGIN
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h>
#include <ESP8266WiFi.h>
#include <BfButton.h>
#include <Espalexa.h>

#define LED 3
#define WIFI_RST 2

#define DEV_NAME ...

WiFiManager wm;
BfButton btn(BfButton::STANDALONE_DIGITAL, WIFI_RST, true, LOW);
Espalexa espalexa;
EspalexaDevice* led;


void stripToggle(uint8_t br, uint32_t rgb) {
  analogWrite(LED, br);
}

void pressCB(BfButton *btn, BfButton::press_pattern_t pattern) {
  if (pattern == BfButton::LONG_PRESS) {
    if (!wm.startConfigPortal(DEV_NAME)) {
      Serial.println("failed to connect and hit timeout");
      delay(2000);
      ESP.reset();
    }
  }
}


void setup() {
  WiFi.mode(WIFI_STA);
  WiFi.hostname(DEV_NAME);
  WiFi.persistent(true);
  WiFi.setAutoConnect(true);
  WiFi.setAutoReconnect(true);
  

  wm.setConfigPortalTimeout(120);
  wm.setConnectTimeout(30);
  wm.setTimeout(120);
  wm.autoConnect(DEV_NAME);

  btn.onPressFor(pressCB, 3000);

  pinMode(LED, OUTPUT);

  led = new EspalexaDevice(DEV_NAME, stripToggle);
  espalexa.addDevice(led);
  espalexa.begin();
}

void loop() {
  espalexa.loop();
  btn.read();
}
#END

Debug Messages

No debug messages. The sketch compiles correctly but doesn't work as intended.

Originally created by @GoTVm on GitHub (Apr 8, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1387 ### Basic Infos #### Hardware WiFimanager Branch/Release: Master Esp8266/Esp32: ESP8266 Hardware: ESP-12e Core Version: 2.4.0 ### Description WiFiManager interferes with ESPAlexa because they both use a WebServer. This could be fixed by passing the webserver WiFiManager is using to ESPAlexa, but I can't seem to find where it creates it so as to pass it as a parameter. Therefore I'm wondering if there is any workaround so I can implement this into my ESPAlexa sketch. ### Settings in IDE Module: NodeMcu Additional libraries: ESPAlexa.h ### Sketch ```cpp #BEGIN #include <ESP8266WebServer.h> #include <DNSServer.h> #include <WiFiManager.h> #include <ESP8266WiFi.h> #include <BfButton.h> #include <Espalexa.h> #define LED 3 #define WIFI_RST 2 #define DEV_NAME ... WiFiManager wm; BfButton btn(BfButton::STANDALONE_DIGITAL, WIFI_RST, true, LOW); Espalexa espalexa; EspalexaDevice* led; void stripToggle(uint8_t br, uint32_t rgb) { analogWrite(LED, br); } void pressCB(BfButton *btn, BfButton::press_pattern_t pattern) { if (pattern == BfButton::LONG_PRESS) { if (!wm.startConfigPortal(DEV_NAME)) { Serial.println("failed to connect and hit timeout"); delay(2000); ESP.reset(); } } } void setup() { WiFi.mode(WIFI_STA); WiFi.hostname(DEV_NAME); WiFi.persistent(true); WiFi.setAutoConnect(true); WiFi.setAutoReconnect(true); wm.setConfigPortalTimeout(120); wm.setConnectTimeout(30); wm.setTimeout(120); wm.autoConnect(DEV_NAME); btn.onPressFor(pressCB, 3000); pinMode(LED, OUTPUT); led = new EspalexaDevice(DEV_NAME, stripToggle); espalexa.addDevice(led); espalexa.begin(); } void loop() { espalexa.loop(); btn.read(); } #END ``` ### Debug Messages No debug messages. The sketch compiles correctly but doesn't work as intended.
kerem closed this issue 2026-02-28 01:28:56 +03:00
Author
Owner

@GoTVm commented on GitHub (Apr 8, 2022):

SOLVED: followed this guide on ESPAlexa's GitHub on how to make them work together and so far it seems to work without issue.

<!-- gh-comment-id:1092867368 --> @GoTVm commented on GitHub (Apr 8, 2022): SOLVED: followed [this guide](https://github.com/Aircoookie/Espalexa/issues/99) on ESPAlexa's GitHub on how to make them work together and so far it seems to work without issue.
Author
Owner

@tablatronix commented on GitHub (Apr 8, 2022):

Ah I see, yeah anything trying to use a webserver , ideally espalexa should have a way to start and stop its webserver also, and not do it in constructor or whatever it is doing. Also yeah passing a single webserver to both libraries would be useful also

<!-- gh-comment-id:1093171681 --> @tablatronix commented on GitHub (Apr 8, 2022): Ah I see, yeah anything trying to use a webserver , ideally espalexa should have a way to start and stop its webserver also, and not do it in constructor or whatever it is doing. Also yeah passing a single webserver to both libraries would be useful also
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#1190
No description provided.