Smart Home Automation

Lock Smart Doors at Night

Home Automation Experts
6 min read

I’ve lost count of how many times I’ve gone to bed only to realize I’d left the front door unlocked. It wasn’t until I set up a Home Assistant automation that locks my smart doors at night unless someone is in the living room that I finally got some peace of mind. My August Smart Lock, which I’ve had for about 3 years now, has been a great addition to my smart home setup - but it’s even more useful with automations like this one. With over 200 devices connected to my Home Assistant instance, I’ve learned a thing or two about how to create powerful and practical automations.

Understanding the Basics of Home Assistant Automation

To build a Home Assistant automation that locks smart doors at night unless someone is in the living room, you’ll need to understand the basics of how automations work in Home Assistant. Essentially, an automation consists of a trigger, a condition, and an action. The trigger is what sets off the automation - in this case, it could be the time of day or the presence of someone in the living room. The condition is what determines whether the automation should run - for example, you might only want the automation to run if it’s actually nighttime. And the action is what the automation does - in this case, locking the smart doors.

I’ve found that using a combination of devices and platforms can make my automations even more powerful. For instance, I use my Philips Hue lights to detect presence in the living room - if someone is there, the lights will turn on, which triggers a sensor that tells Home Assistant someone is present. This setup has been working flawlessly for about 6 months now, with over 1000 successful automation runs.

Setting Up Your Smart Doors and Living Room Sensors

To build this automation, you’ll need to have some smart doors and living room sensors set up in your Home Assistant instance. I use an August Smart Lock on my front door, which integrates seamlessly with Home Assistant. I’ve also got a few motion sensors from Ring scattered around the living room, which detect when someone is present. These sensors are pretty accurate - I’d say they catch about 95% of instances where someone enters the room.

One thing to keep in mind when setting up your smart doors and sensors is to make sure they’re properly calibrated and configured. For example, you’ll want to adjust the sensitivity of your motion sensors so that they don’t trigger falsely - I’ve found that a sensitivity setting of around 50-60 works best for my setup. You should also make sure that your smart doors are properly integrated with Home Assistant - this usually involves adding a new device in the Home Assistant UI and following some prompts to connect it.

Creating the Automation Trigger

The trigger for our automation will be the time of day - we want the automation to run at night, unless someone is in the living room. To set this up in Home Assistant, you’ll need to create a new automation and add a trigger. You can do this by going to the Home Assistant UI, clicking on “Automations” in the sidebar, and then clicking the ”+” button to create a new automation. From there, you can select “Time” as the trigger type and set the time to something like 10 PM.

I’ve found that using a specific time trigger works well for me, but you could also use other triggers - like a sunset or sunrise trigger, which would lock the doors when it gets dark outside. For example, I’ve got an automation that turns on my outdoor lights at sunset, which is triggered by the “Sunset” event in Home Assistant.

Adding Conditions to Your Automation

The condition for our automation will be the presence of someone in the living room. We want the automation to only run if no one is present - if someone is there, we don’t want the doors to lock. To add this condition, you can click on the “Conditions” tab in the Home Assistant UI and select “State” as the condition type. From there, you can select the entity that corresponds to your living room presence sensor - for me, this is a binary sensor called “Living Room Presence”.

One thing to keep in mind when adding conditions is to make sure they’re specific enough to trigger the automation correctly. For example, if you’ve got multiple presence sensors in different rooms, you’ll want to make sure you’re only using the one that corresponds to the living room. I’ve found that using a combination of conditions can also be helpful - for instance, I’ve got an automation that locks the doors at night unless someone is in either the living room or kitchen.

Testing and Refining Your Automation

Once you’ve set up your automation trigger and condition, it’s time to test it out. You can do this by manually triggering the automation in the Home Assistant UI - just click on the “Trigger” button next to your automation to run it. If everything is set up correctly, your smart doors should lock when the automation runs, unless someone is present in the living room.

I’ve found that testing and refining my automations is an ongoing process - there’s always something that can be tweaked or improved. For example, I recently noticed that my automation was triggering falsely due to a faulty motion sensor, so I had to replace it with a new one. With over 200 devices connected to my Home Assistant instance, it’s not uncommon for things to go wrong - but with careful testing and refinement, you can create powerful automations that make your life easier.

Putting it All Together

To build a Home Assistant automation that locks smart doors at night unless someone is in the living room, you’ll need to set up your smart doors and living room sensors, create an automation trigger, add conditions to the automation, and test and refine everything. With these steps, you should be able to create a powerful automation that gives you peace of mind - knowing that your doors will always be locked at night, unless someone is home.

Start by setting up your smart doors and living room sensors, then create a new automation in Home Assistant with a time trigger and presence condition. Test everything out to make sure it’s working correctly, and refine as needed - with a little patience and practice, you’ll be creating powerful automations like a pro.

Tags: #home assistant #smart doors #automation
Share: X / Twitter Facebook

Related Articles