ESPHome: Cannot connect to ESP32-S3 when deep sleep configured

Possibly your deep sleep prevent binary sensor isn’t being imported before it does the check, and so it goes to sleep. Can you see it going to sleep in the logs? Sometimes it’s hard to see logs close to boot.

If you add a ~ 15sec delay to the start of (or before your) check_for_sleep_prevention script you should be able to test this behaviour a bit more.

I’m 77% sure deep_sleep.prevent only prevents the auto deep sleeps ( ie run_duration:) and not manual ones like you’ve got there