I will give you some Arduino code that you might be able to convert to Pi code:
in loop()
if(Blynk.connected()){ // only run Blynk functions if connected to Blynk
Blynk.run();
}
in setup()
timer.setInterval(60000, reconnectBlynk); // check every 60s if connected, needs SimpleTimer library
New function:
void reconnectBlynk() {
if (!Blynk.connected()) {
if(Blynk.connect()) {
BLYNK_LOG("Reconnected");
} else {
BLYNK_LOG("Not reconnected");
}
}
}
Provided by @vshymanskyy at Continuing loop while reconnecting