Build a DIY Keypad Entry System with RFID and Home Assistant
Let's be honest for a second. Keys are a pain. They get lost. They break in locks. They're a security relic from the Bronze Age. And commercial smart locks? They're fine, I guess. If you like paying a premium for features someone else programmed and data you don't control. Here's the thing: what you *actually* want is total control. You want a log of who comes and goes. You want to let the dog walker in with a code that expires. You want to grant access with a wallet card or a fob. You can absolutely have that. It's time to build it yourself.
The Parts List: No Magic, Just Guts You Can Buy
No crazy manufacturing here. This is off-the-shelf hardware. The brain is an **ESP32**—it's cheap, powerful, and has WiFi built right in. That's your ticket to the internet, and to Home Assistant. You'll need a **4x4 matrix keypad** for PIN codes. An **RFID-RC522 reader** handles cards and tags. For the lock itself, a **12V electric strike** or a small **solenoid** is the standard move. Grab a relay module to switch it safely. That's the core. A breadboard, wires, and a 12V power supply round it out. This isn't a $500 kit. It's about $40 in parts and a weekend of your time.
Wiring It Up: From Schematic to Physical Truth
This is the satisfying part. Pull up the pinout diagram for your ESP32. The keypad? That's just eight wires to eight digital pins. The RFID reader uses SPI—MOSI, MISO, SCK, SDA. Hook those to the right pins on the ESP. The relay module's control pin goes to another digital pin. The relay *output* terminals connect to your lock's wires. It feels like magic when you type '1234#' and hear that relay click. But it's not magic. It's just following a map. A very rewarding map.
Teaching Your ESP to Talk to Home Assistant
Here's where the real power kicks in. You'll use ESPHome. It's a framework that lets you configure your ESP32 with simple YAML, no traditional coding. You define the keypad, the RFID reader, and the relay as components. Then, you publish them to Home Assistant as "entities." A few lines of code, and boom—your DIY contraption appears in Home Assistant as a legitimate, first-class device. You'll see a "Keypad" entity. You'll see an "RFID Tag Scanned" sensor. They're alive. Now you can track everything.
Crafting Your Access Rules: The Real Brains
"Is User 'Mike'?" -> "YES" -> "Unlock Door & Log to 'Access Events'". Simple icons, clean lines, dark theme.">The hardware is dumb. It just reports a keypress or a tag ID. Home Assistant is where the **logic** lives. This is your Security Command Center. You create an "input_text" helper for a master PIN code. You create an "input_text" helper to store the last scanned RFID Tag ID. Then, you build automations. "When keypad code '1234#' is entered, trigger the relay for 2 seconds, and log 'Front Door Unlocked via PIN' to a logbook." "When RFID tag with ID '0xFA 0x1B 0xC3' is scanned, trigger the relay and send a notification: 'Jenny just arrived home.'" You can make codes user-specific. You can lock out codes after 10pm. The possibilities are literally endless. You're the admin now.
Lock It Down & Own Your Log
So you've got a working lock. Great. Now, get smart about it. In Home Assistant, create a dedicated logbook view just for door access. Every time that relay fires, make sure an entry is written: who, what, when. Set up an automation to send a critical notification after three failed PIN attempts in a row. That's real security. It's not just a lock; it's a sentry. And the best part? The data sits on your server. Not in a cloud you don't own. You built it. You control it. That beat-up old key in your pocket just got a whole lot less important.