maakbaas / esp8266-iot-framework

Framework for IoT projects implementing HTTPS requests, a React web interface, WiFi manager, live dashboard, configuration manager, file manager and OTA updates.
GNU General Public License v3.0
417 stars 113 forks source link

WiFiManager flow #87

Closed jbanaszczyk closed 3 years ago

jbanaszczyk commented 3 years ago

My suggestion for WiFiManager:

Auto reconnect to defined SSID

If WiFi is started as Captive Portal it should be ready to auto reconnect to defined SID.

State machine could be something like that:

Use projectName as hostname and APname

Lost communication if static config is similar to DHCP

Try to reproduce:

Think about access point password

in WifiManager::startApMode(): something like WiFi.softAP(portalName, WiFi.softAPPSK());

-----------

Code supporting flow you will find here: https://github.com/jbanaszczyk/esp8266-iot-framework/commit/024e8061f424d5499974eda439adb5016acbbd12 It is not ready for pull request because I'm not able to make proper WiFiPage.js (DHCP checkbox is not working properly) and translation is not enough (there are new phrases)

Many thanks for your effort

maakbaas commented 3 years ago

Hi Jacek,

Thanks for your detailed suggestions. Let me respond to each one of them:

Auto reconnect This sounds like a nice addition, but it is important that these changes will be tested thoroughly. The added complexity should not come at the cost of less stability. Are you encountering situations where the framework sometimes starts in AP mode, even though the WiFi network is present? Or is this feature mainly intended for cases where the configured WiFi network is not always available?

use projectName Personally I don't think this is a good idea to add into the framework. It is already possible to set the AP name to the projectName with the current functions, in fact this is done in the hello world example. However, integrating this into the WiFiManager increases the interdepencies between the different parts of the framework. Also, I would like the framework to still work if the json files are completely empty.

lost communication I am not sure if I follow this issue. Are you saying that you lose connection when you first connect using DHCP and then enter a static IP configuration with the same IP that was handed out by DHCP? I can try to reproduce this, but I believe during previous testing I have already done this in my home network without issues. If this is a potential issue, maybe it is different from router to router?

AP Password Do you have a use case for this? Personally I would think that if the AP is mainly used to configure the WiFi settings there is no immediate need to have the AP page password protected. I don't see a problem in adding it as an optional configuration of course.

maakbaas commented 3 years ago

I will close this issue for now since it is one month since my response. Feel free to reopen in the future.