Problem is that, when wifi off, all switches remain ON as on connection

Check this link: [SOLVED] How to run Blynk.run() only when WiFi connection is established it’ll do what you need…