Auto Lock Notification


#1

1) Give a description of the problem
I’m getting the “unlocked” sms message when the restrictions are in place.

2) What is the expected behaviour?
I expect the piston to only run between 9:00pm and sunrise and will the door is unlocked.

3) What is happening/not happening?
The “IF” statement says to run between certain hours when the lock is unlocked but I get the “unlocked” text whenever the door unlocks.

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full

+1ms ╔Received event [Front Door].lock = unlocked with a delay of 84ms
+73ms ║RunTime Analysis CS > 29ms > PS > 6ms > PE > 38ms > CE
+75ms ║Runtime (41222 bytes) successfully initialized in 6ms (v0.3.113.20210203) (73ms)
+76ms ║╔Execution stage started
+116ms ║║Comparison (time) 28728719 is_between (time) 75600000 … (datetime) 1612792800000 = false (7ms)
+118ms ║║Condition #33 evaluated false (38ms)
+119ms ║║Cancelling statement #33’s schedules…
+124ms ║║Requesting time schedule wake up at Mon, Feb 8 2021 @ 9:00:00 PM MST
+126ms ║║Condition group #21 evaluated false (state did not change) (46ms)
+128ms ║╚Execution stage complete. (52ms)
+130ms ║Setting up scheduled job for Mon, Feb 8 2021 @ 9:00:00 PM MST (in 46871s)
+141ms ╚Event processed successfully (141ms)

#2

Try it in this format…, I wasn’t sure if you wanted the text message after the door was unlocked, if yes, just move down SMS task after the wait 10 seconds line

In your existing piston, the SMS block is a standalone IF block that will not take into consideration your restriction on line 22 since it has its own trigger.


#3

Sorry if I wasn’t clear, but what I’m looking for is the if the door doesn’t lock for some reason it would send the text message. I added the 10 second wait so the piston had time to notice if the lock was locked or now.


#4

If I understand you correctly, your problem is that your piston is basically doing what you want and locking the door but then saying it is unlocked? I am a bit surprised that it actually gets that far if the door is locked as wouldn’t expect it to get past the ten second wait, or at least not to do so reliably. Without the wait I can see a failure mode.

When the door is unlocked the piston is responding to an event that has the following details:

Device:    Contact Sensor 1
Attribute: lock
Value:     unlocked

When the condition Contact Sensor 1's lock is unlocked is evaluated it first takes a look at the event that the piston is running to see if it is for the same device (it is) and the same attribute (it is), so it treats the value as the current value. So it sees the door as currently unlocked both times, even though second time around it should be locked.

Had the piston been running for a different reason, e.g. you pressed the Test button, it would have seen the current event doesn’t concern it and so fetch the current value from SmartThings and that should say the door is unlocked in the first condition and is locked in the second one.

That may sound strange, but not half as strange as the alternative which is to be able to write ‘if the door has just changed to locked and it is unlocked’ and get a true answer.


#5

The door locks automatically fine from 9:00PM until sunrise. But when the someone unlocks to door say at 10:00AM the piston sends a message saying the door is unlocked. We only want the message between 9:00PM and sunrise.

I was under the impression by putting the message IF statement within the same IF statement with the time and unlock restrictions it when only run during those times.


#6

Thank you all! I got this working.