Door closed event lagging?


#1

1) Give a description of the problem
Yesterday my piston fired after the door being open for 5 minutes, except it wasn’t open, it was closed. Seemed to be because of some lag issue. Is there a better way to code this?

2) What is the expected behaviour?
The piston is supposed to trigger after the door staying open for 5 minutes.

3) What is happening/not happening?
The door was opened and closed within a few seconds. It seems like the open event lagged and wasn’t registered until after the closed event was registered for some reason. This caused Alexa to tell me the door was open even though it wasn’t. I immediately checked the status of the door in the SmartThings app and it was correctly showing as closed.

**4) Post a Green Snapshot of the piston![image|45x37]


(UPLOAD YOUR IMAGE HERE)

5) Attach logs after turning logging level to Full
9/29/2020, 8:15:21 PM +925ms
+1ms ╔Received event [Home].time = 1601424921608 with a delay of 317ms
+141ms ║Runtime (37157 bytes) successfully initialized in 7ms (v0.3.110.20191009) (140ms)
+142ms ║╔Execution stage started
+1205ms ║║Executed [Echo - Bedroom].playTextAndResume (1043ms)
+1542ms ║║Executed [Echo - Kitchen].playTextAndResume (334ms)
+1828ms ║║Executed [Echo - Office].playTextAndResume (283ms)
+1831ms ║╚Execution stage complete. (1689ms)
+1832ms ╚Event processed successfully (1832ms)
9/29/2020, 8:10:21 PM +522ms
+2ms ╔Received event [Front Door].contact = open with a delay of 6277ms
+76ms ║Runtime (37160 bytes) successfully initialized in 6ms (v0.3.110.20191009) (73ms)
+78ms ║╔Execution stage started
+89ms ║╚Execution stage complete. (12ms)
+91ms ║Setting up scheduled job for Tue, Sep 29 2020 @ 8:15:21 PM EDT (in 299.996s)
+97ms ╚Event processed successfully (97ms)
9/29/2020, 8:10:20 PM +900ms
+1ms ╔Received event [Front Door].contact = closed with a delay of 74ms
+60ms ║Runtime (37160 bytes) successfully initialized in 4ms (v0.3.110.20191009) (59ms)
+61ms ║╔Execution stage started
+70ms ║╚Execution stage complete. (10ms)
+71ms ╚Event processed successfully (71ms)


#2

Nope. Your code is perfect.

Any lag may be due to SmartThings, or a local network congestion…
(the former we can’t do anything about, and the later is a loaded topic)


You could always add a indented condition to check to see if the door is open before speaking…

IE:

IF Contact stays open for 5 min  <-- Trigger
Then
    IF Contact IS open           <-- Condition
    Then
        Speak text
    END IF
END IF

Also, maybe keep the door open for 1.5+ seconds before closing it may help with overlapping signals.


#3

That’s what I was afraid of :smile:

I actually did add that condition as an extra buffer. As for the local network congestion, I don’t have that many ZigBee devices, only about 10 in the whole house. Or would it be a Wi-Fi issue?


#4

If a ZigBee mesh network was too spread out, it may cause lag…
but in this case, your trigger here is Time based, so that is not it.

If the lag is local (and not SmartThings), then then post may be worth reading.
(especially the two tiny links there)