https://github.com/csader/AutoLockDoor/blob/master/AutoLockDoor.groovy
Auto Lock Door app
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****
Installation
The best way to install this code is by using Hubitat Package Manager.
However, if you need to install manually:
- On the Hubitat hub, go to the "Apps Code" page
- Click "+ New App"
- Copy in the contents of AutoLockDoor.groovy
- Click "Save"
- Click "+ New App" again
- 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