Firstly, please forgive my lack of terminology as I’m not quite sure what some of these things are called or even if its been asked for before.
I’ve only just started tinkering with esp32 and I have zero knowledge of circuits or micro controllers/etc. I bought one of these cheap starter kits of aliexpress and using ESPHome I’ve only made a pir sensor and a Bluetooth proxy. I can’t believe how easy that was and I think I’ve got the bug. Got loads of ideas now but I learn better by asking people instead of tutorials that I worry would be ou of date or wrong. Lol
I was wondering if it’s possible to put a battery on an esp32 and use two gpio pins to create a circuit through jump wires inside the door bolt? So when the door is bolted closed it joins the circuit? I really hope that makes sense. I read some posts about taking advantage of sleep mode to prolong battery life.
I don’t want a smart lock for a few reasons but it would be nice for home assistant to know if my doors are locked or not.
If that’s not a good idea would there be another solution without taking my rented apartments lock to bits?
I recently built one of these for my apartment and it is really easy and very satisfying!
FYI I’ve had terrible luck building battery-powered ESPHome sensors; I know it can be done but it’s more work than it sounds like. So I took one of these:
(which I buy handfuls of every time I remember to) and pried the cover open. The circuit board is pretty simple and it’s easy to find the magnetic switch; just solder a wire onto each end of the magnetic switch and carve a little hole in the casing for them to come out of. (This took the longest tbh, I put the hole in the wrong side of the casing the first time.)
to the wires from the door sensor unit - doesn’t matter which one, just one wire to the center pin and one to one of the outer pins. And then I spent about an hour and an increasingly large glob of museum putty (play-dough would also have worked well) positioning it inside the socket where the bolt goes until the bolt presses the switch when it’s locked but leaves it open when it’s unlocked.
You might have to tweak materials depending on how well your lock is constructed, but my landlord just carved a massive hole into the door frame so it was more an issue of getting the switch close enough to the bolt than finding something that would fit behind the bolt.
You only need one gpio and GND. Seed studio for example has nice little esp boards with battery management onboard.
If you want several months/years of battery life from coin cell battery, forget esphome though.
For a lock-state sensor in a rented flat the zigbee door-sensor route is the easy win. Those sonoff pucks you already own have a reed switch inside, run a year or more on a coin cell and drop straight into ZHA or Z2M, so it’s two wires of soldering instead of weeks of chasing battery life on an ESP32. Battery ESPHome sensors can work but j_quadrifrons is right that they take more effort than they look.
If youd rather build the ESP32 version anyway, one GPIO to GND with the internal pull-up and a small reed switch on the frame is all the sensing you need, no two pins through the bolt. The runtime is set by the power stage. A plain 18650 shield boosts the cell to 5V and the supermini C3’s own regulator drops it back to 3.3V, and both stages keep sipping current even in deep sleep. That quiescent draw is the number to shop for: a shield idles in the milliamp range while a low-quiescent 1S board like a MicroPowerCore sits in the tens of microamps, so on the same cell you go from a few weeks to a year or more