I finally did some testing with your suggestions and wired a spare ESP I had according to it. My findings:
btidey wrote:Yes. Wifi connection is not maintained in deep sleep. So it has to reconnect when it wakes up. This does take about 3 seconds normally so the overall wake active time is normally about 1 second longer as you perform an action like mqtt. You can reduce the 3 seconds quite a bit if you are prepared to set the ip address locally on the esp8266 instead of using dhcp for auto ip allocation as that does take quite a large slice of this 3 seconds.
Yeah, I can see Wi-Fi taking around 3-4 seconds, even with setting a static IP. It doesn't actually make a (noticeable) difference if I use DHCP or Static IP.
I see you using another Wi-Fi lib than me. I'm using the standard ESP8266WiFi.h. Not sure if it would make a huge difference if I switch to the lib you're using :/
The MQTT though is pretty fast: MQTT connection is definitely below 1s and sending the actual message is really just milliseconds.
So in total I end up at 4-4.5 seconds after somebody rang the doorbell, which is quite a long time, imho... That's more than 50% it usually takes me to go to the door
So if I can't speed up the Wi-Fi connection, I think deep sleep is probably not the solution for me
Is it correct that there is no sleep mode that keeps the Wi-Fi connection? Or better: I really didn't understand the modem sleep fully: I understood it in a way, that it always wakes up on the Wi-Fi beacon interval, so every time a beacon is sent by the AP it wakes up.
So it seems to keep the Wi-Fi connection!?? Could I use the same trick with the wake up on EN here, too? It would basically mean, that the ESP wakes up
a) Every beacon interval
b) Poor person in the rain, ringing the doorbell
Or is the wake up on EN not possible here?
Thanks again!