Door Lock when Sensor Closes (quickly?)


#1

1) Give a description of the problem
Not sure why the door locks when closed quickly but not if I give it some time.

2) What is the expected behavior?
I’m trying to have the door automatically lock when the sensor is closed no matter how long after piston executes (within reason of course…a few minutes would be nice)

3) What is happening/not happening?
The door locks if the sensor changes to closed quickly. If I wait 10 or so seconds the door will not lock when it closes

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

**5) Attach any logs (From [ST IDE])

12/31/2018, 12:34:17 AM +631ms
+1ms ╔Received event [Front Door Sensor].contact = closed with a delay of 680ms
+75ms ║RunTime Analysis CS > 19ms > PS > 32ms > PE > 23ms > CE
+77ms ║Runtime (39994 bytes) successfully initialized in 32ms (v0.3.109.20181207) (75ms)
+79ms ║╔Execution stage started
+88ms ║║Comparison (string) :a3e58e1c55b9a2d6821e70847df3878e: changes_away_from (string) :ce535ca53e6a2581f40083627e712f86: = false (1ms)
+90ms ║║Cancelling condition #2’s schedules…
+91ms ║║Condition #2 evaluated false (6ms)
+96ms ║║Comparison (string) null executes (string) :45ac4cb9a0906dbc1f84fc001310c002: = false (2ms)
+98ms ║║Cancelling condition #3’s schedules…
+99ms ║║Condition #3 evaluated false (7ms)
+100ms ║║Cancelling condition #1’s schedules…
+102ms ║║Condition group #1 evaluated false (state changed) (17ms)
+108ms ║║Comparison (time) 2057736 happens_daily_at (time) 75600000 = false (1ms)
+110ms ║║Condition #7 evaluated false (5ms)
+111ms ║║Cancelling statement #7’s schedules…
+115ms ║║Requesting time schedule wake up at Mon, Dec 31 2018 @ 9:00:00 PM EST
+118ms ║║Condition group #6 evaluated false (state did not change) (14ms)
+122ms ║╚Execution stage complete. (43ms)
+123ms ║Setting up scheduled job for Mon, Dec 31 2018 @ 9:00:00 PM EST (in 73542.247s)
+133ms ╚Event processed successfully (133ms)
12/31/2018, 12:33:46 AM +326ms
+1ms ╔Received event [Gates Homestead].mode = Night with a delay of 64ms
+10074ms ║RunTime Analysis CS > 15ms > PS > 10033ms > PE > 27ms > CE
+10076ms ║Piston waited at a semaphore for 9999ms
+10078ms ║Runtime (40066 bytes) successfully initialized in 10033ms (v0.3.109.20181207) (10076ms)
+10079ms ║╔Execution stage started
+10090ms ║║Comparison (string) :a3e58e1c55b9a2d6821e70847df3878e: changes_away_from (string) :ce535ca53e6a2581f40083627e712f86: = true (1ms)
+10092ms ║║Cancelling condition #2’s schedules…
+10094ms ║║Condition #2 evaluated true (7ms)
+10095ms ║║Condition group #1 evaluated true (state did not change) (10ms)
+10107ms ║║Comparison (enum) open is (string) closed = false (2ms)
+10109ms ║║Condition #11 evaluated false (10ms)
+10110ms ║║Condition group #10 evaluated false (state did not change) (13ms)
+10121ms ║║Comparison (enum) open is (string) open = true (2ms)
+10123ms ║║Condition #15 evaluated true (9ms)
+10125ms ║║Condition group #14 evaluated true (state did not change) (11ms)
+10128ms ║║Cancelling statement #16’s schedules…
+10206ms ║║Executed virtual command sendPushNotification (72ms)
+10214ms ║║Comparison (time) 2036537 happens_daily_at (time) 75600000 = false (1ms)
+10216ms ║║Condition #7 evaluated false (5ms)
+10217ms ║║Cancelling statement #7’s schedules…
+10222ms ║║Requesting time schedule wake up at Mon, Dec 31 2018 @ 9:00:00 PM EST
+10225ms ║║Condition group #6 evaluated false (state did not change) (15ms)
+10228ms ║╚Execution stage complete. (148ms)
+10230ms ║Setting up scheduled job for Mon, Dec 31 2018 @ 9:00:00 PM EST (in 73563.445s)
+10242ms ╚Event processed successfully (10242ms)


#2

Hi @Whsbb99
I believe it happens because of the IF and other IFs inside that IF
once it was triggered the piston will be done in couple of seconds (that’s why you have to be fast:))))

I have a very similar setup and when I was working with him @WCmore wrote me a piston that works prefectly…
hope it helps…
Let me know if you have any questions…


#3

I’m curious why the ‘door active’ logic is needed. Will the door closed longer than 3 minutes try to lock the door more than once?
thanks.


#4

Thanks. How do you crest a vsriable


#5

Hi @guxdude
If you just want door to be locked after 3 minuties without changin the routine you don’t need that as you suspected… the variable is for my special need… sometimes someone comes, lets say an electrician, he is in & out working. I want door not to be locked in 3 minutes…
I personally stay away from pausing-resuming pistons… in that case controlling the variable when situation changes seemed easier… but this is just a preference thats all…


#6

Thanks for the explanation, @ike2018. That makes sense. I am learning so much. :thinking:


#7

Hi @Whsbb99
In your piston, take a look at rightside. You will see a caption says glabal variables and add a global variable. You can create a global variable by clicking.
For regular variables, on top of your piston you’ll see X2 click on that so you can see variable area. Under DEFINE you can create any type of variable you want…
here is the types
https://wiki.webcore.co/Variable_data_types


#8

You are so welcome @Whsbb99

I stayed avay from variables at the beginning but as your smarthome evolves you realize that you need different settings for different situations and just writing a new piston for each new scenario isn’t the best way, finally I got in to the variables world:))))
I also follow EXAMPLE PISTONS section a lot… great way to learn new stuff.


#9

@ike2018, Another question came to mind on the use of variables for the door active logic. How do you access/change the variable easily? I have a case where I want chimes to ring sometimes when a door gets opened but not all the time. I created a virtual switch which I can flip on/off in the app and then look at that in my piston. I think it is essentially the same but gives me more devices. thanks again.


#10

@guxdude you can have many different ways to change a variable (if it’s not in the same piston it must be global variable)

My methods are (through out all my house/pistons)
a) a simulated switch
b) an actual wall switch
c) again a simulated switch controlled by alexa
d) Timers
e) Events (Lets say two motion sensors in the hallway, A and B
if B gets activated first, A is activated second than variable = XYZ
if A gets activated first, B activated second than variable = ABC
(I haven’t used the last method for a while because I was having some signal issues with motion sensors but my signal has gotten better and I will add it back)