[RELEASE] Auto Lock

Would this work for your use case? Mind testing it out for me.

You can overwrite the Auto Lock Child app code with this:

https://pastebin.com/raw/P1ATDeBZ

Thanks. Just had a chance to test this

This would work well for my use case thanks. I'm having the following issues. Once the option is enabled, the custom duration seems to be on permanently regardless of whether the custom switch was on or off. Only way to revert back to the 15s duration was to disable the custom lock delay

This is my settings:

This is with custom switch on:

Log with custom switch on
app:7832021-07-05 08:26:32.719 pm traceFront Door: updateLabel
app:7832021-07-05 08:26:32.684 pm traceFront Door: lockDoor: The door was locked successfully
app:7832021-07-05 08:26:32.651 pm traceFront Door: lockDoor
app:7832021-07-05 08:21:32.174 pm traceFront Door: updateLabel
app:7832021-07-05 08:21:32.148 pm debugFront Door: Front Door Lock was locked via command [digital]
app:7832021-07-05 08:21:32.146 pm traceFront Door: lock1LockHandler: locked
app:7832021-07-05 08:21:27.726 pm traceFront Door: updateLabel
app:7832021-07-05 08:21:27.696 pm debugFront Door: Lock command sent
app:7832021-07-05 08:21:27.664 pm traceFront Door: lock1Lock
app:7832021-07-05 08:16:22.597 pm traceFront Door: Next retry in 5 seconds. Retries remaining: = 3
app:7832021-07-05 08:16:22.577 pm debugFront Door: Locking door in 15 seconds.
app:7832021-07-05 08:16:22.573 pm traceFront Door: lockDoor
app:7832021-07-05 08:16:22.422 pm traceFront Door: updateLabel
app:7832021-07-05 08:16:22.392 pm debugFront Door: Front Door Lock was unlocked via key or thumbturn [physical]
app:7832021-07-05 08:16:22.390 pm traceFront Door: lock1UnlockHandler: unlocked
app:7832021-07-05 08:16:02.849 pm debugFront Door: customDurationDeviceHandler: Enabling custom delay
app:7832021-07-05 08:16:02.847 pm traceFront Door: customDurationDeviceHandler: on

This is with the custom switch off:

Log with custom switch off
app:7832021-07-05 08:34:03.762 pm traceFront Door: updateLabel
app:7832021-07-05 08:34:03.736 pm debugFront Door: Front Door Lock was locked via command [digital]
app:7832021-07-05 08:34:03.734 pm traceFront Door: lock1LockHandler: locked
app:7832021-07-05 08:33:59.496 pm traceFront Door: updateLabel
app:7832021-07-05 08:33:59.461 pm debugFront Door: Lock command sent
app:7832021-07-05 08:33:59.434 pm traceFront Door: lock1Lock
app:7832021-07-05 08:28:54.371 pm traceFront Door: Next retry in 5 seconds. Retries remaining: = 3
app:7832021-07-05 08:28:54.351 pm debugFront Door: Locking door in 15 seconds.
app:7832021-07-05 08:28:54.347 pm traceFront Door: lockDoor
app:7832021-07-05 08:28:54.264 pm traceFront Door: updateLabel
app:7832021-07-05 08:28:54.231 pm debugFront Door: Front Door Lock was unlocked via key or thumbturn [physical]
app:7832021-07-05 08:28:54.224 pm traceFront Door: lock1UnlockHandler: unlocked
app:7832021-07-05 08:28:34.523 pm traceFront Door: customDurationDeviceHandler: off

Ok, should be a quick fix just need to add another check in the if statement. I'll have an update either later tonight or tomorrow depending on what time the kids go to bed.

3 Likes

Try this one.

https://pastebin.com/raw/xCKjMK9s

Thanks. Its working now. One minor thing, I noticed the custom delay does not kick in after an auto lock count down delay has started. It would be ideal to have the countdown timer reset when the custom switch is turned on/off (similar to the switch to disable the app that would start a new countdown when it is enabled)

e.g.

  1. unlock -15 seconds count down
  2. turn on 5min custom delay switch
  3. lock still locks 15 seconds from (1)

Reverse is also true

  1. turn on 5 min custom delay switch
  2. unlock - 5 min count down started
  3. turn off 5 min custom delay switch
  4. count down does not revert to 15 seconds but instead locks 5 mins later from (2)

I'll have to think about that one. I think it can be done but might introduce some issues. I'll have to figure out how to cancel a specific event triggered scheduled task.

@lewis.heidrick I just installed this app last night and noticed that the "minSecLock"/"Use seconds instead?" question comes up a few times:
image

I put numbers within the title to see which ones were showing:

Wanted you to be aware as I had to ensure both inputs had the same value in order to save it.

Edit: Believe solution is to remove lines 76-78 (the else if) because lines 81-84 will show those settings anyway.

@ritchierich The multiple inputs are from lock with modes selected in the drop-down and you have Away and Night selected giving you two possible inputs. Enable per mode lock delay disabled should collapse them down to a single selection which looks like it's not. I'll get a fix out for it in a bit. I was working on this a while back and got sidetracked to work on something else and never got back to it.

Actually, it looks I already fixed in my dev build. I'll go ahead and push to the public build.

Fix pushed to public build.

2 Likes

Is there a way to have a different delay for closing the door vs mode change? I don't want to lock right away when I close the door, but for mode changes I want it instant. Basically, if I go to any mode but Party mode, I want to lock immediately.

There are so many options it's hard to keep track of it all but you can do pretty much anything you can dream up with it. In some cases, it's a matter of creating a second instance with only the options you want that differ from the others. Do one instance with mode changes and another instance for door close.

Another option with a slightly different behavior is per mode delays which will trigger different timers based on what modes you select.

You can also use the disable with the modes to keep the doors unlocked when in party mode.

Any interest in adding motion sensors with a delay after inactive?

My use case is not wanting the door to lock when when we are sitting out on the porch. I currently have a complex set of rules that include motion sensors, the door contact sensor, the lock state and combined presence to determine when to lock the door. The motion sensors make sure the door does not lock if we home and out on the back or front porch. I wait for a set delay after the door has closed and there is no motion on all of the selected motion sensors or when nobody is left present at the house to automatically lock the doors.

It looks like your app covers all of my needs except the motion sensors. It would be great to replace those rules, but they are working if there is not interest in adding motion sensors.

Thanks for considering.

Yea, I'll add it tomorrow. Should have a version for you to test tomorrow evening. If all good I'll roll it into the build.

2 Likes

Thanks, that would be great. No rush as I probably won’t have time to test it out for a couple of days.

Everything looks like it should work but I would test it. When the motion sensor changes state it switches over to the motion sensor delay and then schedules a method to run to expire the delay timer once the reset window is reached. This was the best way I could come up with to reset from false positives. If you get a lot of false positives I would consider trying another way to detect presence in the backyard such as porch light on or some combination of the two.

https://pastebin.com/raw/4KUcYWW8

Thanks. When I was checking it out none of my Motions Sensors are showing up in the selector for some reason. Suggestion on what I can provide that may help further?

Will I be able to select multiple motion sensors? I have more than one that covers my back porch and I wait for all them to be inactive.

It's currently only configured for one. I can rework it to allow multiple. What brand of motion sensor are you using?

I have a mix of Zigbee old ones from Lowes and the Smartthings branded ones (more recent generation). I also have some Virtual Ring Motion Sensors created by the unofficial Ring integration. To test it further, I just created a virtual motion sensor right now and it did not show up either.

Give this one a try.

https://pastebin.com/raw/TNDnDTp0