Giter Site home page Giter Site logo

Comments (11)

prampec avatar prampec commented on July 19, 2024

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.

1TekPro avatar 1TekPro commented on July 19, 2024

@prampec Any update on this issue?

from iotwebconf.

prampec avatar prampec commented on July 19, 2024

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.

1TekPro avatar 1TekPro commented on July 19, 2024

@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.

prampec avatar prampec commented on July 19, 2024

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.

EricDuminil avatar EricDuminil commented on July 19, 2024

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 a my_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 calling iotWebConf.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.

prampec avatar prampec commented on July 19, 2024

Yes. This is definitely an elegant solution.

from iotwebconf.

EricDuminil avatar EricDuminil commented on July 19, 2024

@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.

EricDuminil avatar EricDuminil commented on July 19, 2024

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.

NilsRo avatar NilsRo commented on July 19, 2024

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.

NilsRo avatar NilsRo commented on July 19, 2024

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)

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.