Reed door switch with deep sleep

Hi, I’m fairly new to HA and very new to esphome and development boards! Firstly I’ll explain what I’m trying to create (apologies if this is something very simple!) I want a Reed switch on the back door which is connected to a nodemcu v3 board which is powered by batteries. When the door is open it shows as ‘open’ in HA and when it’s closed it shows as ‘closed’ in HA so I can create automations based off the state. I don’t need the battery level or anything else reported as I’ve got an automation set up to alert me if the sensor is unavailable (IE batteries are dead so need to be changed!)

So far I’ve got everything wired up so it runs fine but only lasts about 24hours on the battery (18650) eventually I’ll wire up a 2 cell battery holder in parallel so it’ll last even longer but I think I need to venture into the world of deep sleep!

From what I’ve read I need to connect the rst pin to the switch wiring so when the door opens the rst pin goes low and resets the board. I’m fine with the wiring side of things but the coding I’m all a bit confused with!

Can anyone help please?
Thanks in advance!

go for an esp32 with deep sleep. mine last for months with just one 18650.

see here:

Thanks for the reply void. I actually came across your post when I was researching deep sleep and using a reed switch so thanks for your help already! I understand the esp32 has a few more options for deep sleep but was hoping something similar (if a little more unrefined) was possible with the nodemcu as I have a couple left over from a PIR and multisensor project!

tinkered around for a long time with 8266s… deep sleep was always a pain and was never working flawlessly…
at least in my case.

imho save some time a buy a cheap esp32 board :wink: