Giter Site home page Giter Site logo

iotwebconf's Introduction

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

  • Manages WiFi connection settings,
  • Provides a config portal user interface,
  • You can extend the configuration with your own sophisticated propery structure, that is stored automatically,
  • Option to configure multiple WiFi connections. (Try next when the last used one is just not available.)
  • HTML customization,
  • Validation support for the configuration property items,
  • User code will be notified of status changes with callback methods,
  • Configuration (including your custom items) stored in the EEPROM,
  • Firmware OTA update support,
  • Config portal remains available even after WiFi is connected,
  • Automatic "Sign in to network" pop up in your browser (captive portal),
  • Non-blocking - Your custom code will not be blocked in the whole process.
  • Well documented header file, and examples from simple to complex levels.

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

  • In the config portal you can double-tap on a password to reveal what you have typed in. (Double-tap again to hide revealed text.)
  • When accessing the config portal via connected WiFi network a dialog with user-name and password will pop up. The password is the one you have configured for "AP password". The user name is "admin".
  • Consult Users Manual for more details!

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.

  • WiFiManager does not allow you to configure mutiple WiFi connections. In IotWebConf there is a way to define more connections: if one is not available, the next is tried automatically.
  • WiFiManager does not manage your custom properties. IotWebConf stores your configuration in "EEPROM".
  • WiFiManager does not do validation. IotWebConf allow you to validate your property changes made in the config portal.
  • WiFiManager does not support ESP32.
  • With WiFiManager you cannot use both startup and on-demand configuration. With IotWebConf the config portal remains available via the connected local WiFi.
  • WiFiManager provides list of available networks, and an information page, while these features are cool, IotWebConf tries to keep the code simple. So these features are not (yet) provided by IotWebConf.
  • IotWebConf is fitted for more advanced users. You can keep control of the web server setup, configuration item input field behavior, and validation.

Security aspects

  • The initial system password must be modified by the user, so there is no build-in password.
  • When connecting in AP mode, the WiFi provides an encryption layer (WPA/WPA2), so all your communication here is known to be safe. (The exact wifi encryption depends on the used board/chipset and implementation in the related esp/arduino framework.)
  • When connecting through a WiFi router (WiFi mode), the Thing will ask for authentication when someone requests the config portal. This is required as the Thing will be visible for all devices sharing the same network. But be warned by the following note...
  • NOTE: When connecting through a WiFi router (WiFi mode), your communication is not hidden from devices connecting to the same network. It communicates over unencrypted HTTP. So either: Do not allow ambiguous devices connecting to your WiFi router, or configure your Thing only in AP mode!
  • However IotWebConf has a detailed debug output, passwords are not shown in this log by default. You have to enable password visibility manually in the IotWebConf.h with the IOTWEBCONF_DEBUG_PWD_TO_SERIAL if it is needed.

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.

  • ESP8266 uses specific naming for it's classes (e.g. ESP8266WebServer). However, ESP32 uses a more generic naming (e.g. WebServer). The idea here is to use the generic naming hoping that ESP8266 will adopt these "standards" sooner or later.
  • ESP32 does not provide an HTTPUpdateServer implementation. So in this project we have implemented one. Whenever ESP32 provides an official HTTPUpdateServer, this local implementation will be removed.

Customizing and extending functionality

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

TODO / Feature requests

  • We might want to add a "verify password" field.
  • Provide an option, where IotWebConf renders HTML-response, handles HTTP-request for a specific branch of groups.
  • Separate WiFi management from the code, so config portal can also be a standalone solution without any WiFi.

Known issues

  • It is reported, that there might be unstable working with different lwIP variants. If you experiment serious problems, try to select another lwIP variant for your board in the Tools menu! (Tested with "v2 Lower Memory" version.)

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!

iotwebconf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iotwebconf's Issues

Panic /esp8266/2.4.2/cores/esp8266/core_esp8266_main.cpp:134 loop_task

I debug iotwebconf (https://github.com/prampec/IotWebConf/tree/master/examples/IotWebConf01Minimal) , when i finish config.then console out:

Configuration was updated.
Rebooting after 1 second.

Panic /Users/fhf/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.2/cores/esp8266/core_esp8266_main.cpp:134 loop_task

ctx: sys
sp: 3fffed40 end: 3fffffb0 offset: 01b0

stack>>>
3fffeef0: 40104d40 01050ce4 3ffee5f8 00000000
3fffef00: 3ffeee20 3ffee5f8 3fff033c 00000100
3fffef10: 00000000 0104919a 4021eff7 3ffee5e8
3fffef20: 3ffedce0 40100ab6 00000001 00000000
3fffef30: 00000000 40100883 00000000 00000000
3fffef40: 3fffdcc0 3ffe9c80 00000002 3ffe86e4
3fffef50: 00000000 3fffdad0 3ffefb2c 4020ec89
3fffef60: 3ffe9c80 40000f49 3fffdab0 40000f49
3fffef70: 40000e19 40001878 00000004 00000000
3fffef80: 3fffff10 aa55aa55 0000001e 40104424
3fffef90: 4010442a 00000004 00000000 b48a6548
3fffefa0: 4010000d 577a87b4 3232a1f3 00aa6558
3fffefb0: 40100774 3fffef4c 40100721 3fffefd8
3fffefc0: 00000000 4bc6a7f0 0000d593 3ffefb2c
3fffefd0: 00000000 00000000 3ffe86e4 3ffef798
3fffefe0: 00000002 3ffefb2c 4020ecb8 3fffefb0
3fffeff0: 00000000 3fff124c 3ffef770 4020ed72
3ffff000: 00000002 3ffef798 3ffef770 40208130
3ffff010: 0000d593 00000001 3ffef850 4020b585
3ffff020: 0000d593 00000001 40106516 3ffefb2c
3ffff030: 0000d593 00000001 3ffef470 4020ae65
3ffff040: 0000d593 00000001 3ffef470 4020aec8
3ffff050: 0000d593 00000001 3ffef470 4020aed0
3ffff060: 0000d593 00000001 3ffef470 4020aed0
3ffff070: 0000d593 00000001 3ffef470 4020aed0
3ffff080: 0000d593 00000001 3ffef470 4020aed0
3ffff090: 0000d593 00000001 3ffef470 4020aed0
3ffff0a0: 0000d593 00000001 3ffef470 4020aed0
3ffff0b0: 0000d593 00000001 3ffef470 4020aed0
3ffff0c0: 0000d593 00000001 3ffef470 4020aed0
3ffff0d0: 0000d593 00000001 3ffef470 4020aed0
3ffff0e0: 0000d593 00000001 3ffef470 4020aed0
3ffff0f0: 0000d593 00000001 3ffef470 4020aed0
3ffff100: 0000d593 00000001 3ffef470 4020aed0
3ffff110: 0000d593 00000001 3ffef470 4020aed0
3ffff120: 0000d593 00000001 3ffef470 4020aed0
3ffff130: 0000d593 00000001 3ffef470 4020aed0
3ffff140: 0000d593 00000001 3ffef470 4020aed0
3ffff150: 0000d593 00000001 3ffef470 4020aed0
3ffff160: 0000d593 00000001 3ffef470 4020aed0
3ffff170: 0000d593 00000001 3ffef470 4020aed0
3ffff180: 0000d593 00000001 3ffef470 4020aed0
3ffff190: 0000d593 00000001 3ffef470 4020aed0
3ffff1a0: 0000d593 00000001 3ffef470 4020aed0
3ffff1b0: 0000d593 00000001 3ffef470 4020aed0
3ffff1c0: 0000d593 00000001 3ffef470 4020aed0
3ffff1d0: 0000d592 00000001 3ffef470 4020aed0
3ffff1e0: 0000d592 00000001 3ffef470 4020aed0
3ffff1f0: 0000d592 00000001 3ffef470 4020aed0
3ffff200: 0000d592 00000001 3ffef470 4020aed0
3ffff210: 0000d592 00000001 3ffef470 4020aed0
3ffff220: 0000d592 00000001 3ffef470 4020aed0
3ffff230: 0000d592 00000001 3ffef470 4020aed0
3ffff240: 0000d592 00000001 3ffef470 4020aed0
3ffff250: 0000d592 00000001 3ffef470 4020aed0
3ffff260: 0000d592 00000001 3ffef470 4020aed0
3ffff270: 0000d592 00000001 3ffef470 4020aed0
3ffff280: 0000d592 00000001 3ffef470 4020aed0
3ffff290: 0000d592 00000001 3ffef470 4020aed0
3ffff2a0: 0000d592 00000001 3ffef470 4020aed0
3ffff2b0: 0000d592 00000001 3ffef470 4020aed0
3ffff2c0: 0000d592 00000001 3ffef470 4020aed0
3ffff2d0: 0000d592 00000001 3ffef470 4020aed0
3ffff2e0: 0000d592 00000001 3ffef470 4020aed0
3ffff2f0: 0000d592 00000001 3ffef470 4020aed0
3ffff300: 0000d592 00000001 3ffef470 4020aed0
3ffff310: 0000d592 00000001 3ffef470 4020aed0
3ffff320: 0000d592 00000001 3ffef470 4020aed0
3ffff330: 0000d592 00000001 3ffef470 4020aed0
3ffff340: 0000d592 00000001 3ffef470 4020aed0
3ffff350: 0000d592 00000001 3ffef470 4020aed0
3ffff360: 0000d592 00000001 3ffef470 4020aed0
3ffff370: 0000d592 00000001 3ffef470 4020aed0
3ffff380: 0000d592 00000001 3ffef470 4020aed0
3ffff390: 0000d592 00000001 3ffef470 4020aed0
3ffff3a0: 0000d591 00000001 3ffef470 4020aed0
3ffff3b0: 0000d591 00000001 3ffef470 4020aed0
3ffff3c0: 0000d591 00000001 3ffef470 4020aed0
3ffff3d0: 0000d591 00000001 3ffef470 4020aed0
3ffff3e0: 0000d591 00000001 3ffef470 4020aed0
3ffff3f0: 0000d591 00000001 3ffef470 4020aed0
3ffff400: 0000d58f 00000001 3ffef470 4020aed0
3ffff410: 0000d58f 00000001 3ffef470 4020aed0
3ffff420: 0000d58f 00000001 3ffef470 4020aed0
3ffff430: 0000d58f 00000001 3ffef470 4020aed0
3ffff440: 0000d58f 00000001 3ffef470 4020aed0
3ffff450: 0000d58f 00000001 3ffef470 4020aed0
3ffff460: 0000d58f 00000001 3ffef470 4020aed0
3ffff470: 0000d58f 00000001 3ffef470 4020aed0
3ffff480: 0000d58f 00000001 3ffef470 4020aed0
3ffff490: 0000d58f 00000001 3ffef470 4020aed0
3ffff4a0: 0000d58f 00000001 3ffef470 4020aed0
3ffff4b0: 0000d58f 00000001 3ffef470 4020aed0
3ffff4c0: 0000d58f 00000001 3ffef470 4020aed0
3ffff4d0: 0000d58f 00000001 3ffef470 4020aed0
3ffff4e0: 0000d58f 00000001 3ffef470 4020aed0
3ffff4f0: 0000d58e 00000001 3ffef470 4020aed0
3ffff500: 0000d58e 00000001 3ffef470 4020aed0
3ffff510: 0000d58e 00000001 3ffef470 4020aed0
3ffff520: 0000d58e 00000001 3ffef470 4020aed0
3ffff530: 0000d58e 00000001 3ffef470 4020aed0
3ffff540: 0000d58e 00000001 3ffef470 4020aed0
3ffff550: 0000d58e 00000001 3ffef470 4020aed0
3ffff560: 0000d58e 00000001 3ffef470 4020aed0
3ffff570: 0000d58e 00000001 3ffef470 4020aed0
3ffff580: 0000d58e 00000001 3ffef470 4020aed0
3ffff590: 0000d58e 00000001 3ffef470 4020aed0
3ffff5a0: 0000d58e 00000001 3ffef470 4020aed0
3ffff5b0: 0000d58e 00000001 3ffef470 4020aed0
3ffff5c0: 0000d58e 00000001 3ffef470 4020aed0
3ffff5d0: 0000d58e 00000001 3ffef470 4020aed0
3ffff5e0: 0000d58e 00000001 3ffef470 4020aed0
3ffff5f0: 0000d58e 00000001 3ffef470 4020aed0
3ffff600: 0000d58e 00000001 3ffef470 4020aed0
3ffff610: 0000d58e 00000001 3ffef470 4020aed0
3ffff620: 0000d58e 00000001 3ffef470 4020aed0
3ffff630: 0000d58e 00000001 3ffef470 4020aed0
3ffff640: 0000d58e 00000001 3ffef470 4020aed0
3ffff650: 0000d58e 00000001 3ffef470 4020aed0
3ffff660: 0000d58e 00000001 3ffef470 4020aed0
3ffff670: 0000d58e 00000001 3ffef470 4020aed0
3ffff680: 0000d58e 00000001 3ffef470 4020aed0
3ffff690: 0000d58e 00000001 3ffef470 4020aed0
3ffff6a0: 0000d58d 00000001 3ffef470 4020aed0
3ffff6b0: 0000d58d 00000001 3ffef470 4020aed0
3ffff6c0: 0000d58d 00000001 3ffef470 4020aed0
3ffff6d0: 0000d58d 00000001 3ffef470 4020aed0
3ffff6e0: 0000d58d 00000001 3ffef470 4020aed0
3ffff6f0: 0000d58d 00000001 3ffef470 4020aed0
3ffff700: 0000d58d 00000001 3ffef470 4020aed0
3ffff710: 0000d58d 00000001 3ffef470 4020aed0
3ffff720: 0000d58d 00000001 3ffef470 4020aed0
3ffff730: 0000d58d 00000001 3ffef470 4020aed0
3ffff740: 0000d58d 00000001 3ffef470 4020aed0
3ffff750: 0000d58d 00000001 3ffef470 4020aed0
3ffff760: 0000d58d 00000001 3ffef470 4020aed0
3ffff770: 0000d58d 00000001 3ffef470 4020aed0
3ffff780: 0000d58d 00000001 3ffef470 4020aed0
3ffff790: 0000d58d 00000001 3ffef470 4020aed0
3ffff7a0: 0000d58d 00000001 3ffef470 4020aed0
3ffff7b0: 0000d58d 00000001 3ffef470 4020aed0
3ffff7c0: 0000d58d 00000001 3ffef470 4020aed0
3ffff7d0: 0000d58d 00000001 3ffef470 4020aed0
3ffff7e0: 0000d58d 00000001 3ffef470 4020aed0
3ffff7f0: 0000d58d 00000001 3ffef470 4020aed0
3ffff800: 0000d58d 00000001 3ffef470 4020aed0
3ffff810: 0000d58d 00000001 3ffef470 4020aed0
3ffff820: 0000d58d 00000001 3ffef470 4020aed0
3ffff830: 0000d58d 00000001 3ffef470 4020aed0
3ffff840: 0000d58d 00000001 3ffef470 4020aed0
3ffff850: 0000d58d 00000001 3ffef470 4020aed0
3ffff860: 0000d58c 00000001 3ffef470 4020aed0
3ffff870: 0000d58c 00000001 3ffef470 4020aed0
3ffff880: 0000d58c 00000001 3ffef470 4020aed0
3ffff890: 0000d58c 00000001 3ffef470 4020aed0
3ffff8a0: 0000d58c 00000001 3ffef470 4020aed0
3ffff8b0: 0000d58c 00000001 3ffef470 4020aed0
3ffff8c0: 0000d58c 00000001 3ffef470 4020aed0
3ffff8d0: 0000d58c 00000001 3ffef470 4020aed0
3ffff8e0: 0000d58c 00000001 3ffef470 4020aed0
3ffff8f0: 0000d58c 00000001 3ffef470 4020aed0
3ffff900: 0000d58c 00000001 3ffef470 4020aed0
3ffff910: 0000d58c 00000001 3ffef470 4020aed0
3ffff920: 0000d58c 00000001 3ffef470 4020aed0
3ffff930: 0000d58c 00000001 3ffef470 4020aed0
3ffff940: 0000d58c 00000001 3ffef470 4020aed0
3ffff950: 0000d58c 00000001 3ffef470 4020aed0
3ffff960: 0000d58c 00000001 3ffef470 4020aed0
3ffff970: 0000d58c 00000001 3ffef470 4020aed0
3ffff980: 0000d58c 00000001 3ffef470 4020aed0
3ffff990: 0000d58c 00000001 3ffef470 4020aed0
3ffff9a0: 0000d58c 00000001 3ffef470 4020aed0
3ffff9b0: 0000d58c 00000001 3ffef470 4020aed0
3ffff9c0: 0000d58c 00000001 3ffef470 4020aed0
3ffff9d0: 0000d58c 00000001 3ffef470 4020aed0
3ffff9e0: 0000d58c 00000001 3ffef470 4020aed0
3ffff9f0: 0000d58c 00000001 3ffef470 4020aed0
3ffffa00: 0000d58c 00000001 3ffef470 4020aed0
3ffffa10: 0000d58c 00000001 3ffef470 4020aed0
3ffffa20: 0000d58b 00000001 3ffef470 4020aed0
3ffffa30: 0000d58b 00000001 3ffef470 4020aed0
3ffffa40: 0000d58b 00000001 3ffef470 4020aed0
3ffffa50: 0000d58b 00000001 3ffef470 4020aed0
3ffffa60: 0000d58b 00000001 3ffef470 4020aed0
3ffffa70: 0000d58b 00000001 3ffef470 4020aed0
3ffffa80: 0000d58b 00000001 3ffef470 4020aed0
3ffffa90: 0000d58b 00000001 3ffef470 4020aed0
3ffffaa0: 0000d58b 00000001 3ffef470 4020aed0
3ffffab0: 0000d58b 00000001 3ffef470 4020aed0
3ffffac0: 0000d58b 00000001 3ffef470 4020aed0
3ffffad0: 0000d58b 00000001 3ffef470 4020aed0
3ffffae0: 0000d58b 00000001 3ffef470 4020aed0
3ffffaf0: 0000d58b 00000001 3ffef470 4020aed0
3ffffb00: 0000d58b 00000001 3ffef470 4020aed0
3ffffb10: 0000d58b 00000001 3ffef470 4020aed0
3ffffb20: 0000d58b 00000001 3ffef470 4020aed0
3ffffb30: 0000d58b 00000001 3ffef470 4020aed0
3ffffb40: 0000d58b 00000001 3ffef470 4020aed0
3ffffb50: 0000d58b 00000001 3ffef470 4020aed0
3ffffb60: 0000d58b 00000001 3ffef470 4020aed0
3ffffb70: 0000d58b 00000001 3ffef470 4020aed0
3ffffb80: 0000d58b 00000001 3ffef470 4020aed0
3ffffb90: 0000d58b 00000001 3ffef470 4020aed0
3ffffba0: 0000d58b 00000001 3ffef470 4020aed0
3ffffbb0: 0000d58b 00000001 3ffef470 4020aed0
3ffffbc0: 0000d58b 00000001 3ffef470 4020aed0
3ffffbd0: 0000d58b 00000001 3ffef470 4020aed0
3ffffbe0: 0000d58a 00000001 3ffef470 4020aed0
3ffffbf0: 0000d58a 00000001 3ffef470 4020aed0
3ffffc00: 0000d58a 00000001 3ffef470 4020aed0
3ffffc10: 0000d58a 00000001 3ffef470 4020aed0
3ffffc20: 0000d58a 00000001 3ffef470 4020aed0
3ffffc30: 0000d58a 00000001 3ffef470 4020aed0
3ffffc40: 0000d58a 00000001 3ffef470 4020aed0
3ffffc50: 0000d58a 00000001 3ffef470 4020aed0
3ffffc60: 0000d58a 00000001 3ffef470 4020aed0
3ffffc70: 0000d58a 00000001 3ffef470 4020aed0
3ffffc80: 0000d58a 00000001 3ffef470 4020aed0
3ffffc90: 0000d58a 00000001 3ffef470 4020aed0
3ffffca0: 0000d58a 00000001 3ffef470 4020aed0
3ffffcb0: 0000d58a 00000001 3ffef470 4020aed0
3ffffcc0: 0000d58a 00000001 3ffef470 4020aed0
3ffffcd0: 0000d58a 00000001 3ffef470 4020aed0
3ffffce0: 0000d58a 00000001 3ffef470 4020aed0
3ffffcf0: 0000d58a 00000001 3ffef470 4020aed0
3ffffd00: 0000d58a 00000001 3ffef470 4020aed0
3ffffd10: 0000d58a 00000001 3ffef470 4020aed0
3ffffd20: 0000d58a 00000001 3ffef470 4020aed0
3ffffd30: 0000d58a 00000001 3ffef470 4020aed0
3ffffd40: 0000d58a 00000001 3ffef470 4020aed0
3ffffd50: 0000d58a 00000001 3ffef470 4020aed0
3ffffd60: 0000d58a 00000001 3ffef470 4020aed0
3ffffd70: 0000d58a 00000001 3ffef470 4020aed0
3ffffd80: 0000d58a 00000001 3ffef470 4020aed0
3ffffd90: 0000d58a 00000001 3ffef470 4020aed0
3ffffda0: 0000d589 00000001 3ffef470 4020aed0
3ffffdb0: 0000d589 00000001 3ffef470 4020aed0
3ffffdc0: 0000d589 00000001 3ffef470 4020aed0
3ffffdd0: 0000d589 00000001 3ffef470 4020aed0
3ffffde0: 0000d589 00000001 3ffef470 4020aed0
3ffffdf0: 0000d589 00000001 3ffef470 4020aed0
3ffffe00: 0000d589 00000001 3ffef470 4020aed0
3ffffe10: 0000d589 00000001 3ffef470 4020aed0
3ffffe20: 0000d589 00000001 3ffef470 4020aed0
3ffffe30: 0000d589 00000001 3ffef470 4020aed0
3ffffe40: 0000d589 00000001 3ffef470 4020aed0
3ffffe50: 0000d589 00000001 3ffef470 4020aed0
3ffffe60: 0000d589 00000001 3ffef470 4020aed0
3ffffe70: 0000d589 00000001 3ffef470 4020aed0
3ffffe80: 0000d589 00000001 3ffef470 4020aed0
3ffffe90: 0000d589 00000001 3ffef470 4020aed0
3ffffea0: 0000d589 00000001 3ffef470 4020aed0
3ffffeb0: 0000d589 00000001 3ffef470 4020aed0
3ffffec0: 0000d589 00000001 3ffef470 4020aed0
3ffffed0: 0000d589 00000001 3ffef470 4020aed0
3ffffee0: 0000d589 00000001 3ffef470 4020aed0
3ffffef0: 0000d589 00000001 3ffef470 4020aed0
3fffff00: 0000d589 00000001 3ffef470 4020aed0
3fffff10: 0000d589 00000001 3ffef470 4020aed0
3fffff20: 0000d589 00000001 3ffef470 4020aed0
3fffff30: 0000d588 000003e8 3ffef470 4020aed0
3fffff40: 3ffef470 3ffef401 3ffef6b0 402042a7
3fffff50: 3ffe8fee 4021111f 0000000d 4020d47d
3fffff60: 3ffe8c32 00000000 3ffefa54 4020d630
3fffff70: 3ffefa54 3ffef6ec 3ffefa54 4020d6a4
3fffff80: 3fffdad0 3ffef6ec 3ffef6b0 4020410e
3fffff90: 00000001 feefeffe 40203d18 40203cc8
3fffffa0: 00000000 00000000 00000001 3ffefb2c
<<<stack<<<

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld

Q: WiFiScan

Can an addition be made that the list of found networks are displayed in AP mode?
Scan results can indicate if a wifi has protection, which could be used to hide the password field.

Configuration options i can think of are:

  1. ScanWiFiNetworks(true|false) = false = display text box, true = execute WiFi.scanNetworks(); and populate selectbox.
  2. MinimumRssiNeeded
  3. ListOpenNetworks(true|false)
  4. ListSecuredNetworks(true|false)

Change of standard labels and parameters

Hi, @prampec .
How can I change the default labels ("Thing name", "AP password", "WiFi SSID", "WiFi password", "Startup delay (seconds)") for these parameters?
I will be grateful for the answer or for the implementation of this.

this->_thingNameParameter = IotWebConfParameter("Thing name", "iwcThingName", this->_thingName, IOTWEBCONF_WORD_LEN);

this->_apPasswordParameter = IotWebConfParameter("AP password", "iwcApPassword", this->_apPassword, IOTWEBCONF_WORD_LEN, "password");

this->_wifiSsidParameter = IotWebConfParameter("WiFi SSID", "iwcWifiSsid", this->_wifiSsid, IOTWEBCONF_WORD_LEN);

this->_wifiPasswordParameter = IotWebConfParameter("WiFi password", "iwcWifiPassword", this->_wifiPassword, IOTWEBCONF_WORD_LEN, "password");

this->_apTimeoutParameter = IotWebConfParameter("Startup delay (seconds)", "iwcApTimeout", this->_apTimeoutStr, IOTWEBCONF_WORD_LEN, "number", NULL, NULL, "min='1' max='600'", false);

Device Crashes with interrupt during change of connection state

Hi All!
I'm using a high-resolution encoder that uses interrupts to track the length of material traveled.
I'm running into a significant issue that crashes the device when the encoder is tracking and iotWebconf switches connection state at the same time.
This happens with both the ESP8266 and the ESP32.
Does anyone have any idea why this would happen?
I can't for the life of me figure it out, and it's super important for my project that this doesn't happen.
Let me know if there is any info I could give to help!

Thanks in advance!

Can you give me a hint?

Can you give me a hint on how I should update a custom parameter from code without using web?

For instance...

char stringParamValue[STRING_LEN];

IotWebConfParameter stringParam = IotWebConfParameter("String param", "stringParam", stringParamValue, STRING_LEN);

void update_param() {

**What should I write here to assign "Hello" to the parameter**

configSaved(); 
}

Thanks in advance

Best regards.

Do not reset system config when config version changed.

Suggestion:
Let's separate system config (ap password, siid, etc) and custom config versioning.
I assume a version for system config part can be hardcoded and will be only affected when user upgrades to the next release, where those configs layout been changed. While the rest of config is versioned by developer. In this case, when developer changes his custom config layout & bumps a version (or user uploads new firmware), he will not be forced to start over again and configure IoT via AP mode. Device will continue to connect (because those builtin setting will be preserved). User will be able to login on iot inside wifi and update new custom config much easier and faster.
Digging in more details, I suppose system-part data should go first to avoid any offsets (I suppose it already goes first?). This means, when system part is changed - both parts must be reset (PS: if only we don't add some padding for future upgrades)

system version custom version system settings custom setting
- - - -
- changed - reset
changed - reset reset
changed changed reset reset

ESP8266HTTPUpdateServer class compile error on Wemos D1 mini

I get an error when compiling IotWebConf in Arduino IDE for Wemos D1 mini. It shows up even when I try to compile your "IotWebConf01Minimal" example from the repository.

I have searched the net without any luck, so now I try this way. It would be nice to solve this, because I really would like to use IotWebConfig instead of WifiManager. ;-)

And thanks a lot for the good work with IotWebConf !

Arduino:1.8.5 (Linux), Kort:"WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"

Build options changed, rebuilding all
/home/peter/Arduino/libraries/IotWebConf/src/IotWebConf.cpp: In member function 'void IotWebConf::stateChanged(byte, byte)':
/home/peter/Arduino/libraries/IotWebConf/src/IotWebConf.cpp:781:30: error: 'class ESP8266HTTPUpdateServer' has no member named 'updateCredentials'
         this->_updateServer->updateCredentials(IOTWEBCONF_ADMIN_USER_NAME, this->_apPassword);
                              ^
Multiple libraries were found for "WiFiUdp.h"
  Used: /home/peter/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi
Unused: /home/peter/Program/arduino-1.8.5/libraries/WiFi
Unused: /home/peter/Program/arduino-1.8.5/libraries/WiFi
Unused: /home/peter/Program/arduino-1.8.5/libraries/WiFi
Unused: /home/peter/Program/arduino-1.8.5/libraries/WiFi
exit status 1
Error compiling for board WeMos D1 R2 & mini.

Do not print passwords by default

Please, disable passwords prints by default. It can be enabled via additional #define if needed
This prevents e.g. online demos and conference calls... Even showing to the friends over the table doesn't looks safe. Needless to say somebody smart enough can use a portable serial analyzer to still this from already working iot.

I know there is a #define for disabling all prints, but I still would like to have the rest of them.
You did a great security considerations forcing people to set the passwords to device, but this prints reduces security a lot.

Reset a IotWebConfParameter to default?

Is there a way to reset a parameter after it has been configured through the web interface?

I tried the web interface to a separate database containing nodes with a custom struct. When I delete the nodes in the database, I would like to go back to the web side and reset the values to their defaults. Otherwise, when a new parameter is created, it inherits the settings saved for the previous parameter.

It would be especially nice if it was a public function so it could be called from other source files.

Crash when errorMessage is not initialized

When rendering the page for the first time no error message is present for the thingName parameter. When replacing the {e} parameter in the template it crashes.

Solution: Initialize error message in constructor.

IotWebConfParameter::IotWebConfParameter(
const char *label,
const char *id,
char *valueBuffer,
int length,
const char *type,
const char *placeholder,
const char *defaultValue,
const char *customHtml,
boolean visible)
{
this->label = label;
this->_id = id;
this->valueBuffer = valueBuffer;
this->_length = length;
this->type = type;
this->placeholder = placeholder;
this->customHtml = customHtml;
this->visible = visible;
this->errorMessage = "";
}

Unfortunately could not make a branch/pull request. Could you check this and update the repo so will be fixed on PlatformIO?

Thanks!

Error in AP mode

Everything was working fine, but now I have this error, when I load up a new module or if I force an existing one back into Ap mode by connecting to it from my phone.

E (27188) event: mismatch or invalid event, id=63
E (27189) event: default event handler failed!

It seems to be something to do with the ESP32 libraries themselves, but I just cannot get any of my projects that I have build with the IotWebConf to work anymore if the device is in AP mode?

Anyone got a work around?

mDNS and connecting to hostname.local , I cant seem to get it to work

Am I the only one having this issue?

If so can someone walk me through how to set this up.
Its automatically setup as my "thingname" right?
Or is there another step I need to take to init it.

Sorry if this is a stupid question! I'm far from an expert.
Everything else is working great though!

Wrong config version

I am getting the error
"Config size: 165
Wrong config version."
presumably, since I played with other WifiManagers before this one :)
Using iotWebConf.setConfigPin(CONFIG_PIN); and pulling this pin to ground seems to have no effect.
Is there a way to delete an "old" config?

Internal parameters (setter)

Is it possible to have a sample or setters for modify the following internal parameters?
Why? After the first boot and initial configuration, I have a touchscreen display and I want to modify the value directly from the display.
Perhaps i need to reset entirely the previous configuration.

Also, how to access others parameters like MQTT id and pasword? What am I supposed to do? Reread the EEPROM from my stuff?

/**
     * Get internal parameters, for manual handling.
     * Normally you don't need to access these parameters directly.
     * Note, that changing valueBuffer of these parameters should be followed by configSave()!
     */
    IotWebConfParameter* getThingNameParameter() { return &this->_thingNameParameter; };
    IotWebConfParameter* getApPasswordParameter() { return &this->_apPasswordParameter; };
    IotWebConfParameter* getWifiSsidParameter() { return &this->_wifiSsidParameter; };
    IotWebConfParameter* getWifiPasswordParameter() { return &this->_wifiPasswordParameter; };
    IotWebConfParameter* getApTimeoutParameter() { return &this->_apTimeoutParameter; };

store numbers as numbers

Very interesting project, Thanks for providing the code!

except for the missing espasyncwebserver (issue #24), i'm wondering about one more thing:

e.g. in example IotWebConf03CustomParameters.ino, there's a Int, limited with min/max from 1-100, and it's stored in RAM and Eeprom as a 32byte string.

in that case it could be done using one byte - type uint8.

is there a reason you went the char[32] route?

except for the waste of resources, it would be easier is the user-code could access the value of the parameter in correct type (so no need to add another uint8_t and convert from char[] to uint8_t...

it would be very great to have support for unsigned/signed int 8/16/32 as well as float.

what do you think?

Switch off and on the wifi

Hello,

probably it's a weird thing to do, but in my project I don't want to use the wifi all time long, just for some time to set the time up and change the settings.

Is there any way to switch off the wifi (without connecting to the local network or creating an ap) and then switch it on again?

Thanks!

how to get IP Address

I like and use this library.
There is one feature I miss or at least I don't know how it works:
Before I used the WiFi class which supports the WiFi.isavailable and IPAddress function.
I need to print out the IP Address once it's either connected or it opens an access point (...).
I have seen that I can register a callback once it's connected but how to get the IPAddress?
Which function do I have to use/call to get the IPAddress?

User-configurable library settings

Thanks for all the owrk on this library - really useful.

I'm already using EEPROM in setup()
EEPROM.begin(336);

Your library redefines it
EEPROM.begin(IOTWEBCONF_CONFIG_START + IOTWEBCONF_CONFIG_VESION_LENGTH + size);

With this, memory is messed up for your code and mine.

Having limited knowledge of C++, I cannot figure out how to specify my memory requirements without changing your library code, which seems to me to defeat the use of a library.

At the moment I have changed the following lines:

IotWebConf.cpp line 200 - //EEPROM.begin(IOTWEBCONF_CONFIG_START + IOTWEBCONF_CONFIG_VESION_LENGTH + size);

IotWebConf.h line 28 - #define IOTWEBCONF_CONFIG_START 336

Now I'm looking at other settings that can't be changed except by altering the library code, such as IOTWEBCONF_CONFIG_USE_MDNS, IOTWEBCONF_DEBUG_TO_SERIAL, and IOTWEBCONF_ADMIN_USER_NAME.

Am I missing something? Or can you make these settings and options configurable when initialising the library?

Cant Write To EEPROM

I don't know why , i can't write to EEPROM when i'm Write after (for example) :

EEPROM.begin(1024); 
iotWebConf.addParameter(&separatorshift1);
iotWebConf.addParameter(&Param_value_1);
iotWebConf.addParameter(&Param_value_2);

EEPROM.write(600, 12);
EEPROM.write(601, 23);
EEPROM.commit();

if i write before that, i can successfully write to the EEPROM,
any idea why this happened ?

Errors after upgrading ESP8266 board package version from 2.4.2 to 2.5

Hi, I am having issues after upgrading ESP8266 board package version from 2.4.2 to 2.5
I am using IotWebConf 1.2.0
Board resets after changing from state 2 to 2 and trying to connect to WiFi.
Do you have some information regarding this?
I downgraded to 2.4.2 to workaround the issue but i´d like tu updgrade.

By the other hand I need to connect to 2 different MQTT brokers using TLS. So I am doing the following but I am failing to make it work. Can somebody give me any hint?

At the beginning:

WiFiClientSecure net;
MQTTClient client;
WiFiClientSecure net2;
MQTTClient client2;

in setup()

  client.begin("broker1.com", 8883, net);
  client.onMessage(messageReceived);
  client2.begin("broker2.com", 8883, net2);
  client2.onMessage(messageReceived);

in loop()

  client.loop();
  client2.loop();

Thanks in advance.

Drop-down menu for custom parameters?

Hello all!

This is either a feature request or just a request for help.
I am by no means an expert on this stuff, so I'm sorry in advance if this is a stupid question hahaha.

So, for one of the custom string parameters id like to create a drop-down menu with only a few specific options, rather than just a text field. Or really any menu that allows people to choose from only a few options rather than having to type it in.

Is there a simple way to do this? Or is this a feature you would be willing to add?

Any help would be greatly appreciated!

WiFi password length

the input for WiFi password length is limited in the definition file to 33 chars -> for WPA2 the SSID can be max 32 char and the password 63 char

Preprocessor statement in IotWebConf.h is incorrect

#ifdef ESP8266
# include <ESP8266WiFi.h>
# include <ESP8266WebServer.h>
# include <ESP8266HTTPUpdateServer.h>
#else  defined(ESP32)
# include <WiFi.h>
# include <WebServer.h>
#endif

#else defined(ESP32) is not a valid preprecessor statement.

Should probably be

#if defined(ESP8266)
# include <ESP8266WiFi.h>
# include <ESP8266WebServer.h>
# include <ESP8266HTTPUpdateServer.h>
#elif  defined(ESP32)
# include <WiFi.h>
# include <WebServer.h>
#endif

IoTWebConfSeparator

I'll get the following error when compiling example #3 Library 2.0.1 installed

Compiling debug version of 'IotWebConf03CustomParameters' for 'Generic ESP8266 Module'

IotWebConf03CustomParameters.ino: 67:74: error: no matching function for call to 'IotWebConfSeparator::IotWebConfSeparator(const char [19])
IotWebConfSeparator separator2 = IotWebConfSeparator("Calibration factor")
IotWebConf03CustomParameters.ino:67: note candidates are

IotWebConf03CustomParameters.ino:28: In file included from
IotWebConf.h:166: note IotWebConfSeparator IotWebConfSeparator()
IotWebConfSeparator()
IotWebConf.h:166: note candidate expects 0 arguments, 1 provided
IotWebConf.h:163: note constexpr IotWebConfSeparator IotWebConfSeparator(const IotWebConfSeparator&)
class IotWebConfSeparator *: public IotWebConfParameter
IotWebConf.h:163: note no known conversion for argument 1 from const char [19] to const IotWebConfSeparator&
IotWebConf.h:163: note constexpr IotWebConfSeparator IotWebConfSeparator(IotWebConfSeparator&&)
IotWebConf.h:163: note no known conversion for argument 1 from const char [19] to IotWebConfSeparator&&
Error compiling project sources
Debug build failed for project 'IotWebConf03CustomParameters'

Default Values not working

IoTWebConf Version 2.3.0
Using an ESP8266

IotWebConf iotWebConf(thingName, &dnsServer, &server, wifiInitialApPassword, CONFIG_VERSION);
IotWebConfSeparator separator2 = IotWebConfSeparator("Nutrients");
IotWebConfParameter mlGallon = IotWebConfParameter("ML Per Gallon", "mlGallonParam", mlGallonValue, NUMBER_LEN, "number", NULL, "4.9", "step='0.1'");
IotWebConfParameter separator3 = IotWebConfSeparator("Advancied Config (Leave defaults if unsure)");
IotWebConfParameter ticksGal = IotWebConfParameter("Ticks Per Gallon", "ticksGalParam", ticksGalValue, NUMBER_LEN, "number", NULL, "3200", "min='1' max='100' step='1'");
IotWebConfParameter msMl = IotWebConfParameter("ML Per Second", "msMLParam", msMLValue, NUMBER_LEN, "number", NULL, "320.0", "step='0.1'");

The above configuration will show all custom parameters, but the set defaults are not in the input fields, nor does IoTWebConf set the appropriate defaults when the fields are left blank.

I know this issue was supposed to be fixed in 2.1.0, but seems to be reintroduced in 2.3.0.

Setting Hostname

Is there a way to set the hostname?
Currently the device appears as: ESP_nnnnnn (when connected)
It would be nice to have an option to set hostName = thingName
or even better to have an extra field on the config page to set the hostname individually.

How to work only in AP mode

Hello,

This not an issue but more a question:
In my use I just need that my esp32 work in AP mode. But I would like to be able to change the SSID or password of the AP, and other specific things. (this AP will broadcast data by udp)

So how to make IotWebConf only working in AP mode (and not switch to station mode and try to connect to a network.) ?

Thanks

Emmanuel.

Does not play nice with FreeRTOS queues and tasks with Arduino SDK

Hi! I am trying to run IotWebConf with Arduino IDE using queues and tasks.
But I get errors - serial monitor closes connection.

--- Miniterm on /dev/cu.usbserial-1420  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
CAN Receiver
Successfully initialized CAN bus
Config size: 165
Loaded config 'iwcThingName'= 'APNAME'
Loaded config 'iwcApPassword'= '12345678'
Loaded config 'iwcWifiSsid'= 'internet'
Loaded config 'iwcWifiPassword'= '12345678'
Loaded config 'iwcApTimeout'= '30'
State changing from: 0 to 2
0x12: (HEX): 68 65 6C 6C 6F 1A 9B 1E  (DEC): 104 101 108 108 111 26 155 30  (CHAR): h e l l o ␚ � ␞ 
Setting up AP: APNAME
Use password: 12345678
AP IP address: 192.168.4.1
State changed from: 0 to 2
0x12: (HEX): 68 65 6C 6C 6F 1A 9B 1E  (DEC): 104 101 108 108 111
--- exit ---
Exception in thread rx:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Users/ionbuggy/.platformio/penv/lib/python2.7/site-packages/serial/tools/miniterm.py", line 445, in reader
    data = self.serial.read(self.serial.in_waiting or 1)
  File "/Users/ionbuggy/.platformio/penv/lib/python2.7/site-packages/serial/serialposix.py", line 509, in read
    raise SerialException('read failed: {}'.format(e))
SerialException: read failed: [Errno 6] Device not configured


Terminal will be reused by tasks, press any key to close it.

This message in logs from my code, that outputs received messages to serial:

0x12: (HEX): 68 65 6C 6C 6F 1A 9B 1E  (DEC): 104 101 108 108 111

I have few tasks:

  • Receives messages from queue and process them (outputs to serial)
  • Sends demo data to CAN bus
  • Loops iotwebconf every 10 msecs.

Any ideas how to make it all play nice together?

Default value in config form

Hi,
I have just a question,
It seems that default value is not working on the configuration form when empty.
Can you help me by telling me if I am doing something wrong?
Placeholder text is showing ok but if field is not completed default value is not saved.

char mqttServerValue[STRING_LEN];

IotWebConfParameter mqttServerParam = IotWebConfParameter("MQTT server", "mqttServer", mqttServerValue, STRING_LEN, "text", "mymqttserver.com", "mymqttserver.com", NULL, true);

void setup() { iotWebConf.addParameter(&mqttServerParam); }

Am I doing something wrong or my expectations are wrong and the behavior is the expected?
What I need to achieve is that if field is not filled by user, then the default value is saved.

Tanks in advance for your support.

Disconnection Debugging

Could you give an example of handling connection failures? I don't want the library falling back to AP if there's a connection problem, I want to keep trying without blocking and log this.

I see setWifiConnectionFailedHandler, do you have an example?

Password parameter visibility

Is it possible to add the functionality, like in Android (as picture below) and some others OS, to have an icon to make visible the password?

password eye

use of mDNS

It is hard to find the IP of the device in real world applications where serial monitor is unavailable. May be local domain name option can help access to the device more easily. Something like thingConfig.local

Compile errors with new version of Arduino IDE (1.8.9)

Hello,
today I updated my Arduino IDE from 1.8.3 to 1.8.9.
On 1.8.3 my source code, which uses IotWebConf, was compiling and working well.
After that upgrade, I get a lot of errors:

Arduino: 1.8.9 (Linux), Board: "LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

Build options changed, rebuilding all
In file included from /home/giovanni/Arduino/libraries/IotWebConf/src/IotWebConf.h:16:0,
from /home/giovanni/development/projects/mqtt-ir-control/mqtt-ir-control-01/mqtt-ir-control-01.ino:40:
/home/giovanni/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/DNSServer/src/DNSServer.h:67:13: error: cannot declare field 'DNSServer::_udp' to be of abstract type 'WiFiUDP'
WiFiUDP _udp;
^
In file included from /home/giovanni/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/DNSServer/src/DNSServer.h:3:0,
from /home/giovanni/Arduino/libraries/IotWebConf/src/IotWebConf.h:16,
from /home/giovanni/development/projects/mqtt-ir-control/mqtt-ir-control-01/mqtt-ir-control-01.ino:40:
/opt/arduino/libraries/WiFi/src/WiFiUdp.h:27:7: note: because the following virtual functions are pure within 'WiFiUDP':
class WiFiUDP : public UDP {
^
In file included from /opt/arduino/libraries/WiFi/src/WiFiUdp.h:23:0,
from /home/giovanni/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/DNSServer/src/DNSServer.h:3,
from /home/giovanni/Arduino/libraries/IotWebConf/src/IotWebConf.h:16,
from /home/giovanni/development/projects/mqtt-ir-control/mqtt-ir-control-01/mqtt-ir-control-01.ino:40:
/home/giovanni/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/Udp.h:82:27: note: virtual IPAddress UDP::remoteIP() const
virtual IPAddress remoteIP() const =0;
^
/home/giovanni/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/Udp.h:84:26: note: virtual uint16_t UDP::remotePort() const
virtual uint16_t remotePort() const =0;
^
Multiple libraries were found for "WiFiUdp.h"
Used: /opt/arduino/libraries/WiFi
Not used: /home/giovanni/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/ESP8266WiFi
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Do you have any suggestion about how to fix these errors?

Best regards,
Giovanni

PW's displayed in clear text in Serial monitor

First of all.....thanks for your work on this library! While I have made a lot of changes and modifications for my use, you have saved me a lot of time and effort.

I started at version 2.1.0 and am currently using 2.2.1. My question is in regards to the WIFI passwords being displayed in clear text when Serial logging. In IotWebConf::configSave(), unless you #define IOTWEBCONF_DEBUG_PWD_TO_SERIAL, the WIFI passwords are shown as "<hidden>". However, when you change the WIFI password(s) and save the configuration parameters at "/config" and IotWebConf::readParamValue() runs, the WIFI passwords are shown in clear text.

Is there a way to hide them in the second case?

Thx

"thingName" help please

Hi, I know this is not really a issue about the library, but im new to C++, 2 days surfing the web triying to learn about char arrays, pointers and references, but im done, cannot guess how to assign ESP.getChipId() and ESP.getFlashChipId() to thingName, can you give me a clue please?

This is what a wrote:

const String brandName =  "IH";
const String deviceType = "SWITCH01";
const String deviceVersion = "v0.1";
const String espCID = String(ESP.getChipId());
const String espFID = String(ESP.getFlashChipId());

I've tried a lot of std::string, strcpy, strcat, and many others that I cant remember.
So, how can I make thingName look like something like this (concatenation)?:

const char thingName[] = brandName + "-" + 
    deviceType + 
    deviceVersion + "-" +
    espCID + 
    espFID;

thanks in advance!!

Disable Serial Debug

Hi thanks so much for the amazing library.

Is there a way to completely disable the serial debug without having to remove it from the library?

Thanks in advance

Dynamic parameters?

I wonder if it is possible to create dynamically parameters without any errors. Now when I declare a parameter inside the setup function, the parameter is available in the config page, but the parameter div is given the class "de" because the current->errorMessage is not NULL. The error below the input field is mostly "~" but sometimes another random character.

I've edited the example sketch IotWebConf03CustomParameters as a test:

/**
 * IotWebConf03CustomParameters.ino -- IotWebConf is an ESP8266/ESP32
 *   non blocking WiFi/AP web configuration library for Arduino.
 *   https://github.com/prampec/IotWebConf 
 *
 * Copyright (C) 2018 Balazs Kelemen <[email protected]>
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

/**
 * Example: Custom parameters
 * Description:
 *   In this example it is shown how to attach your custom parameters
 *   to the config portal. Your parameters will be maintained by 
 *   IotWebConf. This means, they will be loaded from/saved to EEPROM,
 *   and will appear in the config portal.
 *   Note the configSaved and formValidator callbacks!
 *   (See previous examples for more details!)
 * 
 * Hardware setup for this example:
 *   - An LED is attached to LED_BUILTIN pin with setup On=LOW.
 *   - [Optional] A push button is attached to pin D2, the other leg of the
 *     button should be attached to GND.
 */

#include <IotWebConf.h>

// -- Initial name of the Thing. Used e.g. as SSID of the own Access Point.
const char thingName[] = "testThing";

// -- Initial password to connect to the Thing, when it creates an own Access Point.
const char wifiInitialApPassword[] = "";

#define STRING_LEN 128
#define NUMBER_LEN 32

// -- Configuration specific key. The value should be modified if config structure was changed.
#define CONFIG_VERSION "dem2"

// -- When CONFIG_PIN is pulled to ground on startup, the Thing will use the initial
//      password to buld an AP. (E.g. in case of lost password)
#define CONFIG_PIN D2

// -- Status indicator pin.
//      First it will light up (kept LOW), on Wifi connection it will blink,
//      when connected to the Wifi it will turn off (kept HIGH).
#define STATUS_PIN LED_BUILTIN

// -- Callback method declarations.
void configSaved();
boolean formValidator();

DNSServer dnsServer;
WebServer server(80);

char stringParamValue[STRING_LEN];
char intParamValue[NUMBER_LEN];
char floatParamValue[NUMBER_LEN];

IotWebConf iotWebConf(thingName, &dnsServer, &server, wifiInitialApPassword, CONFIG_VERSION);
IotWebConfParameter stringParam = IotWebConfParameter("String param", "stringParam", stringParamValue, STRING_LEN);
IotWebConfSeparator separator1 = IotWebConfSeparator();
IotWebConfParameter intParam = IotWebConfParameter("Int param", "intParam", intParamValue, NUMBER_LEN, "number", "1..100", NULL, "min='1' max='100' step='1'");
IotWebConfParameter floatParam = IotWebConfParameter("Float param", "floatParam", floatParamValue, NUMBER_LEN, "number", "e.g. 23.4", NULL, "step='0.1'");

// Added
char stringParamTestValue[STRING_LEN];
IotWebConfParameter stringParamTest;

void setup() 
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("Starting up...");

  // Added
  stringParamTest = IotWebConfParameter("String param test", "stringParamTest", stringParamTestValue, STRING_LEN);

  iotWebConf.setStatusPin(STATUS_PIN);
  iotWebConf.setConfigPin(CONFIG_PIN);
  iotWebConf.addParameter(&stringParam);
  iotWebConf.addParameter(&separator1);
  iotWebConf.addParameter(&intParam);
  iotWebConf.addParameter(&floatParam);

  // Added
  iotWebConf.addParameter(&stringParamTest);
  
  iotWebConf.setConfigSavedCallback(&configSaved);
  iotWebConf.setFormValidator(&formValidator);
  iotWebConf.getApTimeoutParameter()->visible = true;

  // -- Initializing the configuration.
  iotWebConf.init();

  
  // -- Set up required URL handlers on the web server.
  server.on("/", handleRoot);
  server.on("/config", []{ iotWebConf.handleConfig(); });
  server.onNotFound([](){ iotWebConf.handleNotFound(); });

  Serial.println("Ready.");
}

void loop() 
{
  // -- doLoop should be called as frequently as possible.
  iotWebConf.doLoop();
}

/**
 * Handle web requests to "/" path.
 */
void handleRoot()
{
  // -- Let IotWebConf test and handle captive portal requests.
  if (iotWebConf.handleCaptivePortal())
  {
    // -- Captive portal request were already served.
    return;
  }
  String s = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/>";
  s += "<title>IotWebConf 03 Custom Parameters</title></head><body>Hello world!";
  s += "<ul>";
  s += "<li>String param value: ";
  s += stringParamValue;
  s += "<li>Int param value: ";
  s += atoi(intParamValue);
  s += "<li>Float param value: ";
  s += atof(floatParamValue);
  s += "</ul>";
  s += "Go to <a href='config'>configure page</a> to change values.";
  s += "</body></html>\n";

  server.send(200, "text/html", s);
}

void configSaved()
{
  Serial.println("Configuration was updated.");
}

boolean formValidator()
{
  Serial.println("Validating form.");
  boolean valid = true;

  int l = server.arg(stringParam.getId()).length();
  if (l < 3)
  {
    stringParam.errorMessage = "Please provide at least 3 characters for this test!";
    valid = false;
  }

  return valid;
}

Webpage:
image

I can edit and save the parameter without any problem. After saving the "de" class is gone. After a reset of the ESP the error is back again.

add a firmware update progress bar

@prampec I wrote some code to add a progress bar when using an OLED display on an esp32. How do I go about adding it so it displays when a user clicks "upload"?
I'm guessing somewhere between:
if(upload.status == UPLOAD_FILE_START){
if(Update.end(true)){
Can this be done by calling it from the main sketch?

AP Error

I try the example IotWebConf06MqttApp as I need it to pre-test.

I comment all stuff from MQTT and when I try to connect to AP I have the following error :

Starting up...
Config size: 549
Wrong config version.
Ready.
AP mode forced by reset pin
State changing from: 0 to 1
Setting up AP: testThing
With default password: smrtTHNG32
AP IP address: 192.168.4.1
State changed from: 0 to 1
Connection to AP.
E (6878) event: mismatch or invalid event, id=63
E (6880) event: default event handler failed!
dhcps: send_offer>>udp_sendto result 0
Request for connectivitycheck.gstatic.com redirected to 192.168.4.1
Request for connectivitycheck.gstatic.com redirected to 192.168.4.1
Request for connect.rom.miui.com redirected to 192.168.4.1

My config is a ESP32.
I precise, with same code, it's ok with a ESP8266.
Something wrong ?

#include <IotWebConf.h>

// -- Initial name of the Thing. Used e.g. as SSID of the own Access Point.
const char thingName[] = "testThing";

// -- Initial password to connect to the Thing, when it creates an own Access Point.
const char wifiInitialApPassword[] = "smrtTHNG32";

#define STRING_LEN 128

// -- Configuration specific key. The value should be modified if config structure was changed.
#undef  CONFIG_VERSION "mqt1"

// -- When CONFIG_PIN is pulled to ground on startup, the Thing will use the initial
//      password to buld an AP. (E.g. in case of lost password)
#define CONFIG_PIN 2 // D2

// -- Status indicator pin.
//      First it will light up (kept LOW), on Wifi connection it will blink,
//      when connected to the Wifi it will turn off (kept HIGH).
#define STATUS_PIN LED_BUILTIN

// -- Callback method declarations.
void wifiConnected();
void configSaved();
boolean formValidator();
void mqttMessageReceived(String &topic, String &payload);

DNSServer dnsServer;
WebServer server(80);
HTTPUpdateServer httpUpdater;
WiFiClient net;

char mqttServerValue[STRING_LEN];
char mqttUserNameValue[STRING_LEN];
char mqttUserPasswordValue[STRING_LEN];

IotWebConf iotWebConf(thingName, &dnsServer, &server, wifiInitialApPassword); IotWebConfParameter mqttServerParam = IotWebConfParameter("MQTT server", "mqttServer", mqttServerValue, STRING_LEN);
IotWebConfParameter mqttUserNameParam = IotWebConfParameter("MQTT user", "mqttUser", mqttUserNameValue, STRING_LEN);
IotWebConfParameter mqttUserPasswordParam = IotWebConfParameter("MQTT password", "mqttPass", mqttUserPasswordValue, STRING_LEN, "password");

boolean needMqttConnect = false;
boolean needReset = false;
int pinState = HIGH;
unsigned long lastReport = 0;
unsigned long lastMqttConnectionAttempt = 0;

void setup() 
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("Starting up...");

  iotWebConf.setStatusPin(STATUS_PIN);
  iotWebConf.setConfigPin(CONFIG_PIN);
  iotWebConf.addParameter(&mqttServerParam);
  iotWebConf.addParameter(&mqttUserNameParam);
  iotWebConf.addParameter(&mqttUserPasswordParam);
  iotWebConf.setConfigSavedCallback(&configSaved);
  iotWebConf.setFormValidator(&formValidator);
  iotWebConf.setWifiConnectionCallback(&wifiConnected);
  iotWebConf.setupUpdateServer(&httpUpdater);

  // -- Initializing the configuration.
  boolean validConfig = iotWebConf.init();
  if (!validConfig)
  {
    mqttServerValue[0] = '\0';
    mqttUserNameValue[0] = '\0';
    mqttUserPasswordValue[0] = '\0';
  }

  // -- Set up required URL handlers on the web server.
  server.on("/", handleRoot);
  server.on("/config", []{ iotWebConf.handleConfig(); });
  server.onNotFound([](){ iotWebConf.handleNotFound(); });
  
  Serial.println("Ready.");
}

void loop() 
{
  // -- doLoop should be called as frequently as possible.
  iotWebConf.doLoop();
  if (needMqttConnect)
  {
    if (connectMqtt())
    {
      needMqttConnect = false;
    }
  }
  else if ((iotWebConf.getState() == IOTWEBCONF_STATE_ONLINE) ) 
  {
    Serial.println("MQTT reconnect");
    connectMqtt();
  }

  if (needReset)
  {
    Serial.println("Rebooting after 1 second.");
    iotWebConf.delay(1000);
    ESP.restart();
  }

  unsigned long now = millis();
  if ((500 < now - lastReport) && (pinState != digitalRead(CONFIG_PIN)))
  {
    pinState = 1 - pinState; // invert pin state as it is changed
    lastReport = now;
  }
}

/**
 * Handle web requests to "/" path.
 */
void handleRoot()
{
  // -- Let IotWebConf test and handle captive portal requests.
  if (iotWebConf.handleCaptivePortal())
  {
    // -- Captive portal request were already served.
    return;
  }
  String s = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/>";
  s += "<title>IotWebConf 06 MQTT App</title></head><body>MQTT App demo";
  s += "<ul>";
  s += "<li>MQTT server: ";
  s += mqttServerValue;
  s += "</ul>";
  s += "Go to <a href='config'>configure page</a> to change values.";
  s += "</body></html>\n";

  server.send(200, "text/html", s);
}

void wifiConnected()
{
  needMqttConnect = true;
}

void configSaved()
{
  Serial.println("Configuration was updated.");
  needReset = true;
}

boolean formValidator()
{
  Serial.println("Validating form.");
  boolean valid = true;

  int l = server.arg(mqttServerParam.getId()).length();
  if (l < 3)
  {
    mqttServerParam.errorMessage = "Please provide at least 3 characters!";
    valid = false;
  }

  return valid;
}

boolean connectMqtt() {
  unsigned long now = millis();
  if (1000 > now - lastMqttConnectionAttempt)
  {
    // Do not repeat within 1 sec.
    return false;
  }
  Serial.println("Connecting to MQTT server...");
  if (!connectMqttOptions()) {
    lastMqttConnectionAttempt = now;
    return false;
  }
  Serial.println("Connected!");

  return true;
}

boolean connectMqttOptions()
{
  boolean result = true;
  return result;
}

Some way of hiding default config parameters

Apologies if I'm missing something but I'd like to be able to hide some of the default config parameters, for example the startup delay and I can't see a way to do that right now.

feature request

hello, I would like to use your iot, to control an LED via mqtt and adafruit.
Adafruit requires 4 parameters to add to the Ap configuration:
server name, port. user and aiokey.
in your examples I did not find the possibility to change the mqtt port.
what is the correct method to add these parameters?
Thank you for your time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.