khoih-prog / Blynk_WM

Blynk and WiFiManager Library for configuring/auto(re)connecting ESP8266/ESP32 modules to the best or available MultiWiFi APs and MultiBlynk servers at runtime, with or without SSL. Configuration data saved in either SPIFFS or EEPROM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to trigger a Config Portal from code

thorathome opened this issue · comments

Hi @khoih-prog
Yes, it's been some while. I'm back at it, adding OTA to all my sketches.

Request: I have forgotten how to cause the Config Portal to come up from a ESP32 or 8266 sketch.
I thought Blynk.clearConfigData(); followed by a ESP.restart(); would do it. The restart works, but the Confog Portal doesn't post.

Would you be kind enough to (re)explain how to get a Config Portal up besides mechanically using DRD? (I'm going for touch-free devices!)

Thanks again for all your help, and in advance.


{
    // Get the Reset button value, Hit Reset and reboot if = 1
    int buttonVal = param[0].asInt();
    Serial.print ( "     " ); 
    Serial.print ( "RESET Button Hit with value = " ); Serial.println ( buttonVal );  

    if ( buttonVal == 1 )
    {
      Serial.println ( " \n REBOOTING " );  
      Blynk.clearConfigData(); 
      delay ( 8000 );  
      ESP.restart();
    }
}


I've been using your Blynk_WM on SONOFFs and on a variety of ESPx monitors. WM Library has been helpful, stable, useful and reliable to me. Thanks.
@thorathome

Hi @thorathome

You're doing correctly, almost, but this

bool LOAD_DEFAULT_CONFIG_DATA = false;

When settings

bool LOAD_DEFAULT_CONFIG_DATA = true;

the lib will ignore the blank data erased byBlynk.clearConfigData(); and continue as normal.

@khoih-prog Thank you, kind sir, for the instantaneous help. You are correct, of course.
Easy to forget details.

I am enjoying the library, working on OTA these days.
Be well. Best wishes.
@thorathome

@khoih-prog Is there a way from code to trigger the Config Portal (for minor changes to field values) without erasing it?

In next release, I'll add a function to let you force entering the Config Portal, from code, so that you can use Hardware, Virtual SW or any condition to trigger Config Portal. Certainly better without erasing Config Data.

Be safe there, BR,

KH

And one more, please. I see the ESP8266 and ESP32 are broadcasting their own WiFi signals (with 6-digit numeric SSIDs) while, otherwise, acting as expected.
Is there an easy way to shut off those signals?

And one more, please. I see the ESP8266 and ESP32 are broadcasting their own WiFi signals (with 6-digit numeric SSIDs) while, otherwise, acting as expected.
Is there an easy way to shut off those signals?

This tempo SSID will appear is only very shortly, if happens.
I experienced this issue with the slow ESP8266-AT-command shields only, and haven't seen on ESP8266/ESP32, at least with the library's examples. I currently haven't met and have no idea yet how to fix.

Check your code to see if and where you call the following functions prematurely, or possibly so much delay() in the code and interfering with the library WiFi operation ???

WiFi.mode(WIFI_AP);
...
WiFi.softAP(portal_ssid.c_str(), portal_pass.c_str(), channel);
...
WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));

Embarrassing for me, I now realize these are the TelNetStream signals I am now using with OTA. All good here.
Enjoy the rest of your Friday.

I'll use any new feature you offer which lets me trigger an uncleared ConfigPortal. It would be a useful capability.

Thanks again @khoih-prog Much appreciated.
@thorathome

Will release with several days. You're very welcome as every time you talk, we'll have new ideas and release.

Thanks to your work and our collaboration, I now have a small fleet of SONOFF switches and a handful of temperature and barometer sensors. I built an air conditioning automatic control system, and use IFTTT for Google Assistant automation. This is fun when I get time to program. Your libraries work and Blynk works.

Be well.

That's good to know the lib somehow is helpful, keeps you going and having fun. I'm looking forward to using devices with your software some time in the future.

I used to write some software for SONOFF SWs, several years ago for fun, to use in my house lightings, controlled by Blynk, Alexa, etc., and haven't so far touched and modified. Luckily they are still working reliably. So busy with maintaining so many libraries now.

I just finished the first mods and tested successfully the lib with the new CP feature. Will release within several days.

The new feature will be

  1. Non-persistent forced CP => you can force to enter the CP once, and clear the request even if you haven't changed /saved new info in the CP. After reset (HW or Virtual SW), the normal operation will resume without CP
  2. Persistent forced CP => request will be cleared only after CP entered and new data saved. Even reset w/o saving new data, the CP will re-appear until new data saved.
  3. I guess you can also use double/multi reset feature with Virtual SW (by pressing the Virtual SW => reset => pressing the Virtual SW again within predetermined time => CP by DRD/MRD. This is currently supported.

Please check the new release


Releases v1.1.1

  1. Add functions to control Config Portal (persistent or non-persistent) from software or Virtual Switches. Check How to trigger a Config Portal from code #25
  2. Add examples to demo the new Virtual ConfigPortal SW feature
  3. Optimize code

and these new examples demonstrating the new features

This useful feature has been added to Blynk_Async_WM Library and will be added to many more Blynk-related libs such as

Every time you introduce a new idea, there are to much work for me, yet make me thinking and enjoying. Thanks.


Releases v1.2.1

  1. Add functions to control Config Portal from software or Virtual Switches. Check How to trigger a Config Portal from code #25
  2. Add examples to demo the new Virtual ConfigPortal SW feature
  3. Optimize code