Comments (11)
That make sense. However (as mentioned in the README) I do only recommend to configure the system in AP mode. I will think about this.
from iotwebconf.
@prampec Any update on this issue?
from iotwebconf.
I understand the problem, and I can agree, that forcing AP mode on every update is not the proper way to handle the things. But I'm still not sure, that the mentioned solution the right one solve this problem.
from iotwebconf.
@prampec Maybe have support for a "developer" option?
I constantly run into this issue. With multiple sketches using eeps and only 1 test board, I have to erase flash often.
from iotwebconf.
Version v3.0.0 is out, but this one is not included in it. I still not decided how to do this properly.
from iotwebconf.
I don't know if this solution is acceptable from a security point of view, but it has worked well for my needs:
- I define AP password, Wifi SSID and Wifi Password in
my_config.h
, which I do not save in git. I have amy_config.template.h
in git, with:
# define AP_PASSWORD ""
# define WIFI_SSID ""
# define WIFI_PASSWORD ""
- I include
my_config.h
in my sketch - I add those lines to
setup()
, before callingiotWebConf.init()
:
iotWebConf.getApPasswordParameter()->defaultValue = AP_PASSWORD;
iotWebConf.getWifiSsidParameter()->defaultValue = WIFI_SSID;
iotWebConf.getWifiPasswordParameter()->defaultValue = WIFI_PASSWORD;
- Since the defaults for those 3 values will always be defined, even if the config version changes or has been reset, I don't need those lines anymore, and delete them from IoTWebConf.cpp (Take this with a grain of salt, I don't know if it has other implications):
if (!validConfig)
{
// -- No config
this->_apPassword[0] = '\0';
this->_wifiParameters._wifiSsid[0] = '\0';
this->_wifiParameters._wifiPassword[0] = '\0';
}
I can nuke the EEPROM, change config_version
or change IOTWEBCONF_CONFIG_START
: after a reset, the thing will always connect to my WiFi, and I won't have to type long passwords on my smartphone.
Additionally, I defined some serial commands (similar to https://github.com/prampec/IotWebConf/blob/master/examples/IotWebConf11AdvancedRuntime/IotWebConf11AdvancedRuntime.ino), in order to change SSID and WiFi password from the serial monitor :
> ssid my_other_wifi
Calling : ssid('my_other_wifi')
Setting WiFi ssid to my_other_wifi
> pwd my_other_password
Calling : pwd('my_other_password')
Setting WiFi password to my_other_password
> save_config
Calling : save_config()
Config version: a11
Config size: 431
Saving configuration
I could post the corresponding code if anyone is interested.
from iotwebconf.
Yes. This is definitely an elegant solution.
from iotwebconf.
@prampec : Good to know, thanks.
I'm not sure I understand the purpose of :
if (!validConfig)
{
// -- No config
this->_apPassword[0] = '\0';
this->_wifiParameters._wifiSsid[0] = '\0';
this->_wifiParameters._wifiPassword[0] = '\0';
}
Are those ever needed? From my limited tests, even if EEPROM is full of random bits and the defaults are not set, the values will be set to an empty string.
from iotwebconf.
If anyone's interested in setting passwords and ssid via Serial, there's an example at https://github.com/EricDuminil/IotWebConf/blob/example/shell_commands/examples/IotWebConf18ShellCommands/IotWebConf18ShellCommands.ino
The sketch is a bit long, but most of it could be moved to shell.h
and shell.cpp
.
Those commands are defined:
ap 0/1 (Enables/disables access point).
ap_pwd abc (Sets AP password to abc).
name abc (Sets ThingName to abc).
reset (Restarts the ESP).
reset_config (Resets the complete IotWeb config).
save_config (Saves the config to EEPROM).
ssid name (Sets SSID to name).
wifi 0/1 (Enables/disables WiFi).
wifi_pwd abc (Sets WiFi password to abc).
It's possible to copy-paste multiple commands at once (at least with PlatformIO monitor), and set everything in one go, without having to type long passwords on a smartphone:
name my_thing
wifi_pwd my_wifi_password
ssid my_ssid
ap_pwd my_ap_password
save_config
The purpose is similar to https://github.com/prampec/IotWebConf/tree/master/examples/IotWebConf11AdvancedRuntime, but I dare say it should be easier to adapt and add new functions.
from iotwebconf.
Any news to preserve system config? Had to go out in the rain today because I reset the config as it show senseless entries and as found here loos the WiFi settings also. Would be really nice to get it separated...should be possible to achieve by reserving a fixed amount of bytes for AP Password, SSID, Password in front of the custom data stored in the eeprom.
from iotwebconf.
Implement a workaround with preferences.h which restores system settings. Perhaps in long term iotWebConf could change to preferences lib which is also available for ESP8266.
NilsRo/HotWaterRecirculatingPump@59bc86e
from iotwebconf.
Related Issues (20)
- server update not work
- Sequencing mDNS after the device is 'online' HOT 7
- show custom page after form saved HOT 1
- Saving a parameter results in ascii characters like '�����' HOT 2
- v3.2.1 works on ESP32E but not on ESP32D
- Question: Load/save config json from spiffs and assign params to local variables HOT 4
- suggested code: add upload progress bar for firmware update
- found bug concerning iotWebConf.delay() during bootup and /firmware
- Problem
- Support for RGB led
- Use as temporary AP without connecting to an existing Wifi
- Won't Connect to Network Sparkfun ESP32 S2 Thing Plus HOT 3
- ver 3.2.1 Error compiling for board LOLIN(WEMOS) D1 mini
- Typo on https://github.com/prampec/IotWebConf/blob/master/doc/UsersManual.md
- Advanced setConfigSavedCallback - provide parameters classes changed
- Improving offline mode
- WiFi password length is limited to 32 characters
- Bug the analogRead will return 0 with IotWebConf.
- MQTT Port setting is missing in MQTT examples
- Unable to commit messages on EEPROM with this library HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iotwebconf.