A simple app that allows you to 1) select a door lock, 2) specify a number of minutes after being unclocked, after which the door should lock, 3) optionally select a contact sensor that must be closed for the auto lock to fire. Edit: the app gives the option to select modes, but it is not part of my app code and does not appear to work properly****
Copy in the contents of SwitchBindingInstance.groovy
Click "Save"
Go to the "Apps" page
Click "Add User App"
Click on Auto Lock Door
Click "Done"
Click on Auto Lock Door in your apps list
Choose your door lock
Set a number of minutes
(Optional) choose a contact sensor
Mode selection does not appear to be working, so I don't recommend using it
Click "Done"
Changelog
v1.01 - Fixed null bug, removed "optional" from contact sensor (thanks @SoundersDude and @chipworkz )
v1.02- added toggle for debug logging (thanks for the idea @lewis.heidrick), and option to set to Seconds instead of Minutes (thanks for the idea @kampto)
v1.03 - @lewis.heidrick fixed the debug toggle
FYI, I tried a "Match Up" in HPM and it didn't find the installed version of your app, so it may be that the few of us who have it installed will need to install from HPM and move any automations over to the HPM version. No biggie for me, as I only have one lock/automation.
It seems like there is a post every week about creating an automatic door lock RM, so it will be nice to point people in this direction instead of trying to fix their RM rule. I know this was one of the first things I setup, and this app makes it effortless.
Agreed, this is awesome! Thank you for sharing and putting this on HPM.
I do have a request though @chris.sader.
Any chance you could turn this into a Parent/Child app?
Specifically I have two locks and would love to have this set for both.
Naive me is thinking it would be easier to treat each Child app just like the app you have right now v.s. turning this app into having multi-lock support.
Edit: I also noticed a bug. When I select what modes I want it to work in, when I go back they are un-selected, as if it forgot.
Not sure if that is a preference bug, or if perhaps modes haven't been implemented?
It's interesting, because my app code doesn't actually have anything in it that has anything to do with modes, so I'm not sure why that mode selector is even showing on the app setup page.