ESP01 deep sleep with reset button

Hi.
I’m planning a project where I run a ESP01 on battery.
I want to put it in deep sleep until I press a button connected to reset.
The ESP will then start and do some stuff and then go beck to sleep.

So I did some reading but I cant figure out how to get the ESP into deep sleep with the yaml code.
From some example code I’ve seen

ESP.deepSleep(0); (it will run forever)

(seems to be c-code). But in ESPHome there way to use deep sleep seems to be

deep_sleep:
run_duration: 10s
sleep_duration: 10min

So what I understand, you need to define a run time and a sleep time. From what I read, since time is a 32 bit integer and in us, the maximum time to sleep is about 71 min. But I want it to sleep forever (untill it’s reset by the switch)

How to do this?
if I omit the sleep_duration: part, will it sllep forever?

Have look at this

he did the deep sleep thing

Not sure how this helps me, need info on howto put the esp in deep sleep with the espHome plugin i Home Assistant.

It’s documented in the ESPhome wiki

Try this perhaps. https://esphome.io/components/switch/shutdown.html

Will answer this myself:
Only set the run_duration seems to put the esp in deepsleep forever.

Can you post your yaml for that please?

deep_sleep:
  run_duration: 60s

The sensor will be awake for a minute and then sleep until reset.

1 Like

That’ve very helpful