I would like to know how to keep running code while using the Blynk provisioning option. I’m trying to create an online/offline solution for customers who are not going to fiddle around in code to put in ssid and server info but may sometimes have wifi and would like to control their device. All examples I have found for working around and reconnecting do not show anything about the provisioning feature or how to circumvent it in the case of no wifi available. I don’t code on a regular basis but seeing as this is supposed to be “easy” I would expect this feature would be a no brainer as a lot of home automation devices have buttons on them that work even when not connected to wifi and still allow you to provision them later. Am I just looking in the wrong place?
I found this elsewhere in the forum but it seems like a dirty fix:
You can use
BLYNK_DISCONNECTED . If you want to run it repeatedly, you could add another state (+ modify state transitions), and run your code there: https://github.com/blynkkk/blynk-library/blob/2b28da0851ffb435a8c5bb825f41dc66ee9d5f92/examples/Export_Demo/Template_ESP8266/BlynkProvisioning.h#L54
I have no issue with using the timer to keep the main loop clean but the timer doesn’t even start if you can’t get past provisioning.
Here is what I would like to do:
If you turn the device on it runs code so that physical buttons and I/O work. If you hold down a button it maybe goes into dynamic provisioning mode to try to connect to a network. If it doesn’t connect after a certain amount of time (ex:2 mins) it exits dynamic provisioning mode and runs the code like normal. Also maybe you can exit dynamic provisioning early mode by holding down the same button again.