Auto-Lock Door Monitor - monitor and automatically lock your doors

:closed_lock_with_key: Auto-Lock Door Monitor

Auto-Lock Door Monitor monitors door openings and closings. Allows for custom schedules and timings to locks the doors and send notifications for any phase of the automation.

:rocket: Version 2026.02.06.15c **

  • recent: a few bug fixes and refactored the timeouts to be more flexible.

Author: LTek

Features

đŸšȘ Door Sensor state monitoring to ensure door is closed before attempting to lock
🎯 Customizable Delays and Timeouts for Actions with Retry logic (for lock jams or misalignments)
🛑 Bypass entity - completely disable the automation based on state of an entitity of your choosing
đŸ§­ïž 3 Disable Schedules - Day and Time to Disable the activity
⏰ Schedule End Triggers - Check and lock door when a schedule ends
📱 Custom Notifications for all phases of the automation
đŸ“± Mobile Notifications with iOS and Android specific options
📌 Persistent Web UI Notifications

source_url: Home Assistant Blueprint: Auto-Lock Door Monitor by LTek · GitHub


[![Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.](upload://3IEiMyDuriGlhMmaFV0iSnXlL0b.svg)](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgist.github.com%2FLtek%2Ff6e517ac49d3e9ecd58714c2b9afe7d3)
2 Likes

@Ltek thanks for this, it works almost perfectly. The only issue I have is I want it to lock within seconds of the door being detected as closed. This works, except that if I unlock the door, but don’t open it for a few seconds, it will auto lock again. It would be good if this could require the door sensor to show door as open before it would lock when it becomes closed again.

The intent is that the door will auto-lock unless the sensor shows it open. There are two timeout variables exposed (see screenshot) you can set to what you’d like


Hey all
 huge update with a lot of new functionality. check it out!

Can this also handle the case where the door is unlocked, but not opened? I still want it to autolock.

Yup, check out the timeout settings

Great blueprint! Thanks a lot for sharing it, I started to use it yesterday it looks like it works great.

I made some small changes to the code to fit my own use case - I wanted to use an input_boolean which enables the automation rather than disables, and I changed one of the schedules to accept input_datetime entities. This allows me to configure the schedule right from the dashboard, without having to go to the automation config.

I was wondering though, can you share why you chose to trigger the automation when the door opens and then have the automation continue running until reaching the timeout, rather than triggering when the door closes and remains in that state for the configured time?

I’m afraid of a case where I would restart home assistant for some reason right when the automation is waiting for the time out. In such a case it would interrupt it from running and leave the door unlocked until the next trigger fires. Of course, I can change the automation to handle this, but I thought maybe I am missing something?
Would appreciate to hear your thoughts.

Hi. Glad you like the blueprint.

I can definitely see the utility of what you did and would like if you would share and i’ll put that update in the system so others can use?

You just flipped the boolean’s effect, fine of course. The existing option “Bypass Entity (optional) -
Automation will not run when this Entity is ON” already turns the automation on and off
 when the Entity is ‘off’, the automation runs, when ‘on’ the automation will not run. Its the same result. A bypass entity is the common way of doing this since most automations are meant to run most of the time, and only occasionally disabled. I could simply make an option that the user selects which way they want it
 On = Enabled, or On = Disabled / Bypass

Setting a Schedule via a dashboard is a nice idea for sure
 If you want to share the code, I’ll update the BP.

Also if you want to take on the challenge, I thought it would kinda be cool to have be able to define a list of schedules, then from the dashboard, be able to select one that would be used in the blueprint.
I think that would require

input_select helper (to use as the chooser on the dashboard)

  • whatever number of `schedule helpers’ you want
  • a template sensor

this would make it UI-editable, Drop-down driven, and blueprint/automation-friendly and Stable across HA releases

It does what you are wanting.

Here’s how it works:

  1. Door opens → Automation triggers
  2. Wait for door to close → Waits up to door_close_timeout minutes
  3. Door closes → Verification period begins
  4. Verification wait → Waits for verification_timeout (10-600 seconds or minutes, depending on your verification_timeout_unit setting)
  5. Re-check door state → If door is still closed after verification period, lock the door

There is no built-in way to disable the door_close_timeout. We could do that
 but then that automation could be running forever :wink:

We could easily change the built-in setting that has a max in the UI of 15 minutes
 easy to allow that value to be any higher number like 60 or even 1440 for 24 hours. That is just by changing

selector:
number:
min: 1
max: 15
step: 1

Which is cool, but a description should warm people that it will be gone after a reboot/restart, and long time frames start to defeat the purpose of the automation
 which is to alert you when the door is open longer than you expect/want.

While it is pretty easy to add, I did not add a helper to make it survive reboots because 1/ people should not be restarting HA often 2/ most timeframes to open/close/lock a door should not be that long

if you want to add to the code, I’d certainly upload it

I’m having an issue with notifications.

Every time I unlock my door manually, I get a “Auto-Lock Failed to lock door after multiple attempts” notification.

Then when I open the door, I get another “Auto-Lock Failed to lock door after multiple attempts”.

And when I lock it manually, I get “Auto-Lock locked door successfully”.

Other than that, it’s working great and very appreciated!

Please post your YAML, I’ve seen this a few times myself but yet to figure out why
 I suspect its a very specific situation so I want to compare yours and mine.

thx!

Here is the YAML for my current configuration.

alias: 🔐 Auto-Lock Door Monitor by LTek
description: ""
use_blueprint:
  path: Ltek/autolock-ltek.yaml
  input:
    door_lock: lock.front_door_lock
    door_sensor: binary_sensor.front_door_opening
    door_close_timeout: 15
    verification_timeout_unit: seconds
    verification_timeout: 60
    notify_device:
      - 403df8d2de709b547d40a70749df733d
    notify_monitoring_start: false
    notify_lock_success: true
    counter_variable: counter.door_lock_retries
    notify_data:
      - high_priority
    notify_max_retries: true

I had disabled the notifications earlier. Now when I turned them back on, I noticed that, after unlocking and locking the door manually, I don’t get the “Auto-Lock locked door successfully” notification until the 60 second verification timer has expired. But I still get the “Auto-Lock Failed to lock door after multiple attempts” message as soon as I unlock it and as soon as I open the door.

Just uploaded 2026.02.05.11c 
 lmk if that fixes it. I also added a notification option for manually locking the door.

The new version is better, but also worse. I don’t get any of the false notifications when I unlock, lock, or open the door (good), but now it fails to lock the door (bad). When the 60 second verification timer expires, then I get the “Auto-Lock Failed to lock door after multiple attempts”.

Also, I get the “Door was manually locked” notification when I lock it manually, but I also get it when I lock it from my HA dashboard. Is that expected?

uploaded 2026.02.05.12c, try this one.
so far I tested, and it worked as expected
 : Unlock → Kept Closed and Unlocked → Open → Closed

I need to test Unlocked → Open → Keep Open

HA does not know if you ‘physically’ or ‘by automation’ changed something so it considers them both manually. I put that in there mainly for debug. You can disable it in the settings.

Looks like I had a problem with my retry counter. I saw it twice in the Entities list for some reason. I deleted it, created a new one with a different name, and configured that one in the blueprint, and now it appears to be working correctly. Thanks for the help, and also for creating this blueprint!

I decide to refactor a little and make the timeouts ‘cleaner’ using seconds for everything. And I added better explanations for how each setting works.

I’ll post a new version after I test a bit more.

just uploaded v14c
 it tests fine for me, LMK!

It works well for me, but I’m not sure the Wait for Door to Close timer is working. I have it set to 30 seconds and left the door open for about a minute before closing it, and it still auto-locked (and I never got the “Door is still open at schedule end” notification). That’s what I want, but I suspect not what you intended. Or am I misunderstanding that timer?

@brianewman
Just fixed this
 I changed the last revision to use Seconds, the code was still using Minutes. thx for the testing!

v15c all fixed up.

btw
 I have a separate blueprint for ‘Repeating Alerts’ (door, window, etc is left open), that one can pair well with this for when the door is left open for an extended period of time. I use it for alert/alarms also (water leaks, smoke alarms, etc)

  • It has worked fine for a year but considering adding features. If you use that LMK if there is anything you could use with it.