[RELEASE] Auto Lock

Np, I'll getcha fixed up.

1 Like

Well I was not able to duplicate my test where it locked while the motion sensor was active. At the moment it is not locking at all, I got the following error:

app:7132021-07-26 09:11:52.885 pm errorjava.lang.NullPointerException: Cannot invoke method contains() on null object on line 472 (lock1UnlockHandler)

From the test build that is this line:
} else if (evt.descriptionText.contains('physical') && evt.descriptionText.contains('unlocked') && settings.eventNotifications?.contains("2")) {sendEventNotification("${evt.descriptionText}")

Event notification 2 is notify when unlocked physical. My guess is the notification device is empty. When this option is checked it has to have a phone selected to send the notification to.

I just uploaded my current build after I posted this as well. Update with HPM, open the app and make sure there is a notification device or the option is unselected, and see if you still get error.

I did not have any of the notification options turned on when I got that error. But that could be something as I did have the notifications turned on for the lock I was using on the previous test.

I will update to the latest on HPM and let you know what I find. Thanks for working on this with me!

@lewis.heidrick
Hi Lewis,

Have a small issue, or maybe I just don't understand. I am wanting to use Auto Lock with my Modes. Pretty simple, when the Mode goes into arm lock all the doors and when the Mode goes into disarm unlock the front door. So the lock portion work flawlessly and there is a choice in a drop box of which mode to use like this....

Now the Unlock portion is where I am getting confused, I choose Unlock with Modes, but no drop down box appears to choose which mode to use to unlock, Like this....

I haven't been able to get the unlock with modes to work, so maybe I am just missing something?

Here is a log output when the it locked while motion was still active. I had to use trace to see the motion changing. You can see the motion goes inactive after the door locked.

app:7172021-07-27 03:23:18.306 pm traceTest Auto Lock: motionDurationDeviceHandler: inactive
app:7172021-07-27 03:23:17.178 pm traceTest Auto Lock: updateLabel
app:7172021-07-27 03:23:17.046 pm traceTest Auto Lock: Sending Event Notification: Front Door Lock State was locked
app:7172021-07-27 03:23:17.043 pm debugTest Auto Lock: Front Door Lock State was locked
app:7172021-07-27 03:23:17.037 pm traceTest Auto Lock: updateLabel
app:7172021-07-27 03:23:17.032 pm traceTest Auto Lock: lock1LockHandler: locked
app:7172021-07-27 03:23:16.935 pm debugTest Auto Lock: Lock command sent
app:7172021-07-27 03:23:16.919 pm traceTest Auto Lock: lock1Lock
app:7172021-07-27 03:22:41.845 pm traceTest Auto Lock: motionDurationDeviceHandler: active
app:7172021-07-27 03:22:34.588 pm traceTest Auto Lock: motionDurationDeviceHandler: inactive
app:7172021-07-27 03:22:17.958 pm traceTest Auto Lock: motionDurationDeviceHandler: active
app:7172021-07-27 03:22:11.920 pm traceTest Auto Lock: Next retry in 5 seconds. Retries remaining: = 3
app:7172021-07-27 03:22:11.888 pm debugTest Auto Lock: Locking door in 1 minutes.
app:7172021-07-27 03:22:11.884 pm traceTest Auto Lock: lockDoor
app:7172021-07-27 03:22:11.736 pm traceTest Auto Lock: updateLabel
app:7172021-07-27 03:22:11.654 pm traceTest Auto Lock: Sending Event Notification: Front Door Lock State was unlocked [digital]
app:7172021-07-27 03:22:11.651 pm debugTest Auto Lock: Front Door Lock State was unlocked [digital]
app:7172021-07-27 03:22:11.648 pm traceTest Auto Lock: lock1UnlockHandler: unlocked
app:7172021-07-27 03:21:46.768 pm traceTest Auto Lock: motionDurationDeviceHandler: inactive

It seems like the cause of the null pointer exception was not missing notification devices as I still got it when I had a notification device selected. I think it might have to do with this August Lock and Door Sense driver that I use on one of my locks. I only get the error when that lock is selected.

It is also available on HPM, but understand if that might be an issue with this driver and not something you are prepared to support. I appreciate the all the effort here.

Once I get the kids to bed I'll take a look. Should be simple.

I'll need a day or so to dig into the driver and see if I can track down what is causing it. I have an all day meeting tomorrow but I'll take a look when I get home.

Changed the 7 to a 6 on line 123 of latest release and everything is back to working it appears.

if (!settings.whenToUnlock?.contains("6")) {

I'll include the change in the release once I get a chance to look at Mike's issue. You can make the change yourself if you want in the meantime and should restore the functionality.

1 Like

The simple auto lock app must be on steroids now a days :crazy_face: I've found that when messing around a lot with instances, it's best to just delete the instance and start over to clear things out. Might help the people trying to make magic happen.

It's more likely a coding mistake on my part. I work all day then have 4 kids that take my attention most of the evening. That leaves just the late evening for my coding hobby. I often find myself working on code way after I should be in bed and often after I've had a few drinks. Usually it's a simple typo I overlook.

For Chad's issue I don't know that I have enough trace logging to find where the issue is.

1 Like

@MikeSas Before I go ripping a bunch of code apart try this one for me and see if it clears the scheduled lock. Replace the Auto Lock Child app code with the text from the raw pastebin below.

https://pastebin.com/raw/RpCNMJku

I pasted in the new Child app code and the result was the same.

app:7172021-07-27 09:52:52.519 pm traceTest Auto Lock: Sending Event Notification: Front Door Lock State was locked
app:7172021-07-27 09:52:52.516 pm debugTest Auto Lock: Front Door Lock State was locked
app:7172021-07-27 09:52:52.513 pm traceTest Auto Lock: lock1LockHandler: locked
app:7172021-07-27 09:52:52.457 pm debugTest Auto Lock: Lock command sent
app:7172021-07-27 09:52:52.440 pm traceTest Auto Lock: lock1Lock
app:7172021-07-27 09:51:51.442 pm traceTest Auto Lock: motionDurationDeviceHandler: active
app:7172021-07-27 09:51:47.458 pm traceTest Auto Lock: Next retry in 5 seconds. Retries remaining: = 3
app:7172021-07-27 09:51:47.397 pm debugTest Auto Lock: Locking door in 1 minutes.
app:7172021-07-27 09:51:47.389 pm traceTest Auto Lock: lockDoor
app:7172021-07-27 09:51:47.206 pm traceTest Auto Lock: updateLabel
app:7172021-07-27 09:51:47.095 pm traceTest Auto Lock: Sending Event Notification: Front Door Lock State was unlocked [digital]
app:7172021-07-27 09:51:47.089 pm debugTest Auto Lock: Front Door Lock State was unlocked [digital]
app:7172021-07-27 09:51:47.086 pm traceTest Auto Lock: lock1UnlockHandler: unlocked
app:7172021-07-27 09:51:21.707 pm traceTest Auto Lock: motionDurationDeviceHandler: inactive
app:7172021-07-27 09:50:53.661 pm traceTest Auto Lock: motionDurationDeviceHandler: active
app:7172021-07-27 09:50:44.899 pm traceTest Auto Lock: motionDurationDeviceHandler: inactive

Just to confirm, I did not alter my existing child app for the test. I did open it and hit done after replacing the code. Let me know if I need to do something different.

This may look like a simple problem but if it's what I think it is then it's actually a lot harder than it seems. I honestly don't have time to continue working on it tonight since I have to head to work in 5 hours but I'll take a look tomorrow evening.

From what I see I'm guessing the unlock handler is detecting an unlock with "lock when unlocked" set it is doing what it's suppose to and relocking based on that method and the motion method isn't clearing the scheduled locking event.

I have to incorporate a check for the motion handler into the unlock handler and override when triggered somehow.

I am not in any rush. I appreciate you just attempting to figure this out. Please take your time. It sounds like you have lots going on with work and kiddos. Get some sleep.

Ambien told me to go to bed so to bee I go. I'll get it fixed up tomorrow.

1 Like

Thanks Lewis!!!!!! That fix done the trick, working like a charm now. 4 kids? Where do you get the time to have an uninterrupted thought man? Hats off to you!

Give this one a try and let me know how it works for you. Gonna get some sleep now. I'll follow up tomorrow.

https://pastebin.com/raw/pDAXzUYP

@KurtSanders Can you try these settings with the version linked below?

https://pastebin.com/raw/pDAXzUYP


1 Like

@lewis.heidrick I will give it a try this weekend when we return home. Thanks so much!