Advertisement

Home/Automation & Logic

Implementing a Duress Code System for Your Smart Locks with Home Assistant

Advanced Home Assistant for DIY Security Enthusiasts · Automation & Logic

Advertisement

Okay, let's get real for a sec. Our smart locks are fantastic for convenience. Letting the dog walker in. Granting access to a friend. But we talk about security a lot less. What happens if someone is standing right behind you? What if they... persuade you to open your door? It's a dark thought, but planning for the worst-case scenario is what real security is about. That's where a duress code comes in. It looks like any other code on your lock. But using it sends a silent, screaming alert straight to your phone and your smart home hub. No sirens. No blaring alarms. Just a covert signal that says, "Help. Now." Sound useful? It is. Let's build it.

Advertisement

Your Hidden Pin, Their Big Mistake

Here's the thing: a duress code isn't about stopping the entry. It's about controlling what happens *after*. The bad guy thinks they've won. They got the code. The door unlocked. But behind the scenes, your home just switched to a whole different mode. Lights might start flickering in a pattern to signal neighbors. A camera in the hallway discreetly starts recording and uploading to the cloud. Your partner gets a text with your location. Maybe every smart speaker in the house starts quietly dialing 911. The goal is to create a time advantage and gather evidence without escalating the immediate confrontation. It turns your smart home from a convenience gadget into a proactive guardian.

Setting the Stage in Home Assistant

First, you need your lock in Home Assistant. Hopefully, you're already there. If not, get that sorted. I'm assuming you know your way around the UI. We're building an automation, but we need a trigger that *looks* normal. Most lock integrations expose an event for "lock unlocked with code." That's our golden ticket. We're not checking for a specific "good" code. We're waiting for one specific *bad* code—the duress pin. When that code is used, it fires our automation. The lock still opens. Nothing seems amiss. But the automation engine just got a kick in the pants.

Crafting the Silent Alarm Automation

This is the fun part. Open Automations and create a new one. For the trigger, choose "Lock is unlocked with code." Pick your lock. Now, here's the critical bit. You need to find the "code slot" number for your duress pin. You set that up in your lock's own app first—assign your secret code to a slot, say, slot 10. In the trigger, add a condition: "code_slot" equals 10. Boom. The automation now *only* runs for that code. Now for the actions. This is your personal panic button sequence. Add a notification to your phone. Make it loud and clear. Send a critical alert to your spouse's phone. Start a camera recording. Log the event persistently. You can even have an Alexa or Google Assistant routine triggered via a dummy switch to make an outbound call. Get creative, but keep it silent and effective.

The Dry Run: Testing Without the Terror

Do not, I repeat, DO NOT just set this and forget it. You have to test it. But you don't want to freak everyone out. Here's how. First, disable any "scary" actions like calling the cops. Keep the notifications, but maybe send them to a test channel. Then, physically go to your door. Take a deep breath. Enter your duress code. The door should unlock normally. Wait. Check your phone. Did the notification come through? Did the log populate? If yes, you're golden. Re-enable your full action list. Now you have a system that works. It's a weird feeling, testing a panic button. But the confidence it gives you is worth every second.

A Layer, Not a Force Field

This isn't a magic spell. It's a clever layer. It works because it uses the attacker's assumption—that the code is genuine—against them. It buys you what might be the most important minutes of your life. Pair it with other common-sense stuff. Good lighting. Strong doors. Relationships with neighbors. A duress code is the digital equivalent of having a plan. And honestly, setting this up in Home Assistant took us what, twenty minutes? For a system that could be utterly vital. That's a no-brainer. Sleep a little better tonight.