prampec / IotWebConf

ESP8266/ESP32 non-blocking WiFi/AP web configuration Arduino library
MIT License
523 stars 140 forks source link

IotWebConf Build Status

Upgrading to v3.0.0

Lately version 3.0.0 is released. This release is not backward compatible with older versions, and some modification have to be done on existing codes. Please visit Migration Guide for details!

Summary

IotWebConf is an Arduino library for ESP8266/ESP32 to provide a non-blocking standalone WiFi/AP web configuration portal. For ESP8266, IotWebConf requires the esp8266 board package version 2.4.2 or later!

Please subscribe to the discussion forum, if you want to be informed on the latest news.

Also visit experimental Discord server.

HELP WANTED! If you are testing any GIT branches, please give me feedback to provide stable releases for the public.

Highlights

Screenshot Screenshot

How it works

The idea is that the Thing will provide a web interface to allow modifying its configuration. E.g. for connecting to a local WiFi network, it needs the SSID and the password.

When no WiFi is configured, or the configured network is unavailable it creates its own AP (access point), and lets clients connect to it directly to make the configuration.

Furthermore there is a button (or let's say a Pin), that when pressed on startup will cause a default password to be used instead of the configured (forgotten) one. You can find the default password in the sources. :)

IotWebConf saves configuration in the "EEPROM". You can extend the config portal with your custom configuration items. Those items will be also maintained by IotWebConf.

Visit Users Manual for detailed description!

Use cases

  1. You turn on your IoT the first time - It turns into AP (access point) mode, and waits for you on the 192.168.4.1 address with a web interface to set up your local network (and other configurations). For the first time a default password is used when you connect to the AP. When you connect to the AP, your device will likely automatically pop up the portal page. (We call this a Captive Portal.) When configuration is done, you must leave the AP. The device detects that no one is connected, and continues with normal operation.
  2. WiFi configuration is changed, e.g. the Thing is moved to another location - When the Thing cannot connect to the configured WiFi, it falls back to AP mode, and waits for you to change the network configuration. When no configuration was made, then it keeps trying to connect with the already configured settings. The Thing will not switch off the AP while anyone is connected to it, so you must leave the AP when finished with the configuration.
  3. You want to connect to the AP, but have forgotten the configured AP WiFi password you set up previously - Connect the appropriate pin on the Arduino to ground with a push button. Holding the button pressed while powering up the device causes the Thing to start the AP mode with the default password. (See Case 1. The pin is configured in the code.)
  4. You want to change the configuration before the Thing connects to the Internet - Fine! The Thing always starts up in AP mode and provides you a time frame to connect to it and make any modification to the configuration. Any time one is connected to the AP (provided by the device) the AP will stay on until the connection is closed. So take your time for the changes, the Thing will wait for you while you are connected to it.
  5. You want to change the configuration at runtime - No problem. IotWebConf keeps the config portal up and running even after the WiFi connection is finished. In this scenario you must enter username "admin" and password (already configured) to enter the config portal. Note, that the password provided for the authentication is not hidden from devices connected to the same WiFi network. You might want to force rebooting of the Thing to apply your changes.

User notes

IotWebConf vs. WiFiManager

tzapu's WiFiManager is a great library. The features of IotWebConf may appear very similar to WiFiManager. However, IotWebConf tries to be different.

Security aspects

Compatibility

IotWebConf is primary built for ESP8266. But meanwhile it was discovered, that the code can be adopted to ESP32. There are two major problems.

Customizing and extending functionality

IotWebConf is ment to be developer friendly by providing lots of customization options. See HackingGuide for details.

TODO / Feature requests

Known issues

Credits

Although IotWebConf started without being influenced by any other solutions, in the final code you can find some segments borrowed from the WiFiManager library.

Thanks to all contributors providing patches for the library!