Power on with momentary button

Hi, Im hoping someone can help or can at least tell me if it is possible or not.

I am running WLED on a D1 mini, in an enclosure, powered from a battery, No issues so far. I am currently powering on the D1 with a simple switch, and have a momentary button to trigger macros.

I would like to remove the switch and use the button to power on the D1. I know this is not possible in itself, but is it possible to use the button to send the D1 into ‘deep sleep’ and then the button again to wake it from deep sleep?

Is this possible?

Thank you for any help as i’m struggling to find any solution.

What button are you using?

Just a basic push button…

momentary push button? Feel stupid but I can’t find any that I can use except those capacitive tp223

Standard automotive toggle switches in the ON / OFF configuration should do nicely. You can get a nice look with a red accidental toggle prevention cover like used in TV shows & movies to enable some horrible action like triggering a bomb or something.

I am kidding about the cover, but it would be useful in certain situations where the enclosure might be sliding around (like in a car).