Home Aautomation: If no WIFI or internet available for some time

Hello Blynker , I am using Mega2560+ESP8266 for Home automation, where 4 switches and 4 loads are connected.
loads can be controlled using corresponding switch and also through BLYNK mobile app.
Everything works fine if WiFi and Internet is there.
But it looks like hang situation when ESP8266 is removed or WiFi is switched OFF. I expect that loads should still be controlled using switches. Can you advise me how to do it?
I tried using a timer1 interrupt , It works fine if ESP8266 is removed. But as soon as ESP8266is put back and switched on it hangs if I press any switch.
I also tried putting my check_pin() function inside blinkLedWidget() which is called by timer . but agin it hangs as soon as I press any switch.
Can I do by reducing the timeout of Blynk.run() ??? How?

Pl. advise!

Take a look at this one:

Basically you can manage WiFi connection completely manually in your codeā€¦