Building an Automation to Automatically Lock ALL Doors and Windows When Armed
You've done the late-night, pre-vacation scramble. Phone, keys, wallet. You hit "Arm" on your security system. The adrenaline fades. Then it hits you. *Did I check the back sunroom window? The one the cat uses?* Panic. You have to undo everything. This isn't about convenience anymore; it's about peace of mind. A truly secure home doesn't leave room for doubt. Here's how to build a system that actually covers everything. No guesswork.
The "Whole-Home" Mindset Your Current System Lacks
Most security systems just trip an alarm when a contact opens. Big whoop. A smart home shouldn't just *react*. It should *prepare*. Think of it as a pre-flight checklist. Before the "armed" state is even possible, every single point of entry needs a hard status: locked and closed. That means every smart lock, every door sensor, and critically, every window sensor. You're not just monitoring; you're creating a hard rule. The "armed" state becomes a fortress, not just a tripwire.
Your New "Security Sergeant" Automation
Here's the logic. It's simple, but brutal. You're not building a fancy scene; you're programming a sergeant who doesn't accept excuses. When I tell the house I'm leaving (via voice, a dashboard button, or a scheduled time), the automation runs a single, critical check. It polls every door lock, every door contact, and every window sensor. If any single one reports "unlocked" or "open," the entire process stops. No arming. Instead, it blasts a clear notification to my phone: "FAILED TO ARM. Back Patio Door is OPEN." The automation does the worrying for you. Actually, it does the *checking* for you.
Building the "No Mercy" Check in Home Assistant
Open your automations.yaml. Breathe. We're creating a new automation. The trigger is whatever starts your "Away" mode. The action is a "Choose" block. This is your logic fork. Option 1, the default path: a condition checks a group you've made containing every single door and window entity. If they're all good, it proceeds to arm the alarm and maybe turn off lights. Option 2, the important one: if the condition is NOT met, you branch to an action that sends that critical notification. Use actionable notifications if your phone app supports them. "Back Patio Door is OPEN. Tap here to view camera." That's the power move.
Pressure-Testing Your Defenses
Don't just set it and forget it. That's how you get a false sense of security. Test it. Deliberately leave a window cracked. Try to arm the system. Did the alert fire immediately? Good. Now, close the window but leave the door unlocked. Another test. The goal is to fail until you can't anymore. Make this a weekend ritual for a month. You're not testing the tech; you're training your own brain to trust the system. Because when you get that "All Clear" notification as you're driving away, you'll actually feel it. Relief. Not a nagging doubt.