I’ve not done any deep/light sleep experiments with the ESP32, but I did do some with the ESP8266.
One thing I found was that assigning a static IP address in your code saved a lot of time. Routers keep a table of connected devices and tend to purge this after a fairly short while when a device disconnects. When a “new” device (one that’s no longer in that table) attempts to connect via DHCP, the router and the device do a little dance where they negotiate an IP address and the router sends the other data (gateway, DNS Server etc) to the ESP. This all takes time, whereas with a static IP it’s more of an instantaneous thing that bypasses all the DHCP negotiation.
Even when the router does have an entry in its routing table (which will be the case in this example with just a few seconds of sleep time), part of the process is still required and it takes longer than with a static IP.
The other thing is that once you have the Wi-Fi connection, you are having to wait for both the Blynk and MQTT connections to be established.
Is your MQTT server a cloud service, or a local server?
If it’s a local server then there’s a simple solution, which is to install Node-Red and the Blynk plug-in for Node-Red and let that take care of sending the data to Blynk. That way you only have to establish the MQTT connection, which will be quicker.
This is the approach I take with my weather station, although I don’t use any form of sleep as I need to constantly receive wind speed, wind direction and rainfall data via interrupt routines (and I have power available for my ESP8266 anyway).
The other thing to think about (any you may already have done this) is what happens if you can’t establish a connection to either Wi-Fi, Blynk or MQTT.
If you’re using Blynk.begin the this will block all other code execution and keep trying to connect until either it does connect, or the battery is flat.
Blynk config and connect are the better solution, along with a process that limits the number of attempts to make the various connections.
Also, with sleep routines you have to break the Blynk rules of using timers and keeping the void loop clean. You actually want the void loop to run just once, then go back to sleep.
Have you seen this topic?..
Pete.