vintlabs / fauxmoESP

Add voice control of your ESP32 and ESP8266 devices using Amazon Alexa
MIT License
375 stars 70 forks source link

AsyncServer is not stopped even when Fauxmo is disabled #257

Open ramanraja opened 3 weeks ago

ramanraja commented 3 weeks ago

I have been using fauxmoESP on ESP8266 with hard-coded WiFi credentials. Recently I tried to integrate WiFi Manager (https://github.com/tzapu/WiFiManager) into my project; this library enables configuring WiFi credentials on the fly without hard coding them, and has become a standard accessory for ESP boards. But I could not connect my browser to the WiFi Manager portal when Fauxmo was running in the background. WiFi Manager works fine when fauxmo is not initialized. This is probably because Fauxmo uses AsyncSever, which may not be able to coexist with the web server run by the WiFi Manager. Fortunately WiFi Manager is not required all the time, so the press of a button starts it manually when the user wants. I tried to disable Fauxmo before starting WiFi Manager portal. But this did not help. Upon inspection of the code, I found that fauxmoESP::enable(true) starts the AsyncServer if not already running. But fauxmoESP::enable(false)merely resets the _enabled flag, disabling the UDP pump. With my limited understanding of the design, I feel the Async server has to be stopped when enable(false) is invoked. Please clarify if my understanding is correct, or if there are other reasons to keep the server running all the time. That will greatly help me integrate these two incompatible technologies. Thanks.