Sleep wifi

Hello everyone. I want to modify a perfume aromatizer machine that will be in the bathroom. I want it to activate the air freshener when the light comes on. I have an esp8266-01 recorded with esphome and it is powered by a 3.7v battery. From what I was testing the consumption of Wi-Fi is going to make the battery not last even a week. Is there a way to make wifi sleep?

Thank you very much

Thank you very much. I will read and if I have any questions I ask them. If I can get it to work I’ll post it. Thank you

Hello. If I put him to sleep and at that moment a lamp comes on and I tell him that he has to do something, he will not be able to do it because he is asleep. What I want to do is not possible, is it?

It certainly would be on an esp32, you could sense the light going on with a light sensor attached to a wakeup pin. But esp8266 does not have that facility.

However I did see some code for an esp8266 that used a sensor on RST to wake it up. Don’t ask me where I saw that.

Good idea. I am going to put a sensor and surely I will achieve more battery life. Being in a bathroom you could see the difference in light. Thank you very much