Usually when your device was notified of an update you need to actively stay awake longer than 4sec - more like 30~60sec.
An OTA flash will not stop your code from running during the download phase, so if you send your device back to sleep your OTA will fail.
1 Like