How to skip 'BlynkEdgent' initialization on start?

I am using an example from Blink BlynkEdgent. Sometimes I need to use the device without internet, but without internet connection the controller hangs at the beginning on BlynkEdgent.begin().

How can I skip the initialization of BlynkEdgent.begin() so that I can start the controller without internet.
Or wait for a connection at startup for about one minute, and if there is no connection, skip it.

Is there a reason why you’re using Blynk Edgent?
Do you need the dynamic provisioning and/or Blynk.Air OTA functionality?

Pete.

Yes, I need the ability to change Wi-Fi data, because these data are often changed. And I don’t want to constantly update the firmware. And the controller is far from me, so the OTA function is needed.

And why do you ask? Is this a problem?

The Edgent sketch is very complicated. To make changes to how it works you’ll need to understand tge sketch fully.
You haven’t really explained in any great detail what it is that you’re trying to achieve, and that makes it difficult for any Edgent users to indicate if they think it’s possible to achieve.

You can use Blynk.Air quite easily without Edgent, but dynamic provisioning isn’t possible.

Of course, if your aWiFi credentials change then your device can’t be re-provisioned via OTA, so you’d need to be on-site to achieve that with Edgent.

Pete.

The person who will use it will not be able to reprogram the controller himself, but will be able to enter new Wi-Fi data from the phone.

In short, the controller will measure the temperature and control the compressor.
The Wi-Fi router is turned on during the day and turned off at night. Therefore, it is necessary that the controller works at night and without the Internet.

Am I correct in understanding that the BlynkEdgent sketch will not work without internet?
This is strange, because the situations can be different, for example, the Internet was temporarily turned off, and then the controller’s work will be completely paralyzed.

The Blynk Edgent sketch is just an example which showcases the capabilities of dynamic provisioning and Blynk.Air.
Obviously control via the Blynk mobile or web desktops doesn’t work without an internet connection, so building-in offline capabilities doesn’t make much sense when you’re creating this type of showcase example.

The problem is that for all of the complex Edgent stuff to work, the sketch becomes quite unwieldy (and would be even more unwieldy if offline functionality was incorporated into the example). This makes if difficult for people to change the example to work in a significantly different way, such as working autonomously whilst offline.

You’ll need to un-pick the various aspects of how the example works, then re-write it to incorporate the functionality that you require.

I would have thought that your task would be easier if you solved some basic environmental issues, such as not changing the WiFi credentials on a regular basis, or leaving WiFi on 24/7, but presumably you’ve already considered that approach, which leaves you with the difficult task of significantly re-writing the Edgent example.

Pete.

Thank you for your reply.

I think that I have solved for myself the issue of starting the controller without the Internet. At the first launch, the program waits for one minute to establish a connection to the phone and waits for Wi-Fi network data. And after a minute, it simply exits the waiting cycle.

#include "BlynkEdgent.h"

const unsigned long maxWaitTime = 60000; // 60 seconds
unsigned long startTime;

void setup() {  
  BlynkEdgent.begin(); 
  startTime = millis();
}

void loop() {
  if (millis() - startTime <= maxWaitTime) {   
    BlynkEdgent.run();
  } else if (WiFi.status()== WL_CONNECTED) {    
    BlynkEdgent.run();
  } 
}

ConfigMode.h

unsigned long startTime2 = millis();  

while (BlynkState::is(MODE_WAIT_CONFIG) || BlynkState::is(MODE_CONFIGURING)) {
    delay(10);
    dnsServer.processNextRequest();
    server.handleClient();
    app_loop();

    if (BlynkState::is(MODE_CONFIGURING) && WiFi.softAPgetStationNum() == 0) {
        BlynkState::set(MODE_WAIT_CONFIG);
    }

    if (millis() - startTime2 >= maxWaitTime) {
        break;  
    }
}

Am I thinking in the right direction? So far it works. I still have to do the function of rechecking the network connection.