Dog Door Tracking - Restricting Triggers


#1

1) Give a description of the problem
I have created a piston to track when our dog leaves, returns, and run some automations if the door is opened from the outside (without the dog having previously left). The state of the door is tracked by a ST Multipurpose sensor, and I’m using the x-axis to determine whether it was first opened from the inside or the outside.

The door can swing both ways (it hangs vertically and typically swings both directions for a couple of seconds after the dog enters or leaves).

2) What is the expected behaviour?
If the door is first opened from the inside (x-axis value goes above 400, meaning the door was pushed outward), note that the dog has left.
If the door is then later opened from the outside (x-axis value goes below -400, meaning the door was pushed inward), note that the dog is back inside.
If the door is opened from the outside while the dog is still inside, turn on the lights and notify me. (Suggesting another animal, or a person, has opened it).

3) What is happening/not happening?
Because the door swings both directions once it’s pushed open (e.g. if the dog leaves, the door will swing back both directions (negative and positive x-asis values) until it stops the swing back at a nearly neutral value. Both “if” triggers are triggering every time the door opens, because it swings both directions.

I’ve tried restricting it by creating the “processing” variable, with the hopes that the first trigger will lock out the second (for when the door swings back), so only the proper trigger plays out, but it seems that the “processing” variable doesn’t get updated quick enough, so WebCore registers both events.

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

5) Attach logs after turning logging level to Full

8/14/2019, 8:17:11 PM +173ms
+1ms ╔Received event [Home].time = 1565835419800 with a delay of 11373ms
+141ms ║RunTime Analysis CS > 28ms > PS > 63ms > PE > 49ms > CE
+144ms ║Runtime (49843 bytes) successfully initialized in 63ms (v0.3.10e.20190628) (141ms)
+145ms ║╔Execution stage started
+146ms ║╚Execution stage complete. (1ms)
+147ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:21:24 PM MDT (in 252.902s)
+156ms ╚Event processed successfully (156ms)
8/14/2019, 8:16:59 PM +100ms
+0ms ╔Received event [Home].time = 1565835419800 with a delay of -701ms
+8961ms ║RunTime Analysis CS > 26ms > PS > 8888ms > PE > 48ms > CE
+8962ms ║Piston waited at a semaphore for 8828ms
+8965ms ║Runtime (49916 bytes) successfully initialized in 8888ms (v0.3.10e.20190628) (8964ms)
+8966ms ║╔Execution stage started
+8967ms ║╚Execution stage complete. (1ms)
+8969ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 1s), with 1 more job pending
+8981ms ╚Event processed successfully (8982ms)
8/14/2019, 8:16:57 PM +703ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -78,1041,-123 with a delay of 164ms
+106ms ║RunTime Analysis CS > 20ms > PS > 47ms > PE > 39ms > CE
+109ms ║Runtime (49853 bytes) successfully initialized in 47ms (v0.3.10e.20190628) (106ms)
+109ms ║╔Execution stage started
+117ms ║║Comparison (decimal) -78.0 rises_above (integer) 400 = false (1ms)
+118ms ║║Condition #11 evaluated false (5ms)
+119ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+125ms ║║Comparison (decimal) -78.0 drops_below (integer) -400 = false (0ms)
+126ms ║║Condition #18 evaluated false (5ms)
+127ms ║║Condition group #17 evaluated false (state did not change) (6ms)
+129ms ║║Fast executing schedules, waiting for 1968ms to sync up
+2122ms ║║Executed virtual command setVariable (3ms)
+2125ms ║║Cancelling statement #33's schedules...
+2443ms ║║Executed physical command [Echo - Living Room Dot].setVolumeAndSpeak([100, Anya has returned.]) (310ms)
+2444ms ║║Executed [Echo - Living Room Dot].setVolumeAndSpeak (311ms)
+2446ms ║╚Execution stage complete. (2337ms)
+2447ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:21:24 PM MDT (in 264.071s)
+2459ms ╚Event processed successfully (2459ms)
8/14/2019, 8:16:56 PM +663ms
+2ms ╔Received event [Dryer Sensor].threeAxis = -95,1045,-118 with a delay of 142ms
+97ms ║RunTime Analysis CS > 23ms > PS > 38ms > PE > 36ms > CE
+100ms ║Runtime (49852 bytes) successfully initialized in 38ms (v0.3.10e.20190628) (98ms)
+101ms ║╔Execution stage started
+107ms ║║Comparison (decimal) -95.0 rises_above (integer) 400 = false (1ms)
+108ms ║║Condition #11 evaluated false (4ms)
+109ms ║║Condition group #10 evaluated false (state did not change) (5ms)
+114ms ║║Comparison (decimal) -95.0 drops_below (integer) -400 = false (1ms)
+115ms ║║Condition #18 evaluated false (4ms)
+116ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+118ms ║╚Execution stage complete. (18ms)
+119ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 3.018s), with 1 more job pending
+129ms ╚Event processed successfully (129ms)
8/14/2019, 8:16:55 PM +648ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -85,1043,-119 with a delay of 137ms
+102ms ║RunTime Analysis CS > 23ms > PS > 39ms > PE > 40ms > CE
+105ms ║Runtime (49853 bytes) successfully initialized in 39ms (v0.3.10e.20190628) (103ms)
+106ms ║╔Execution stage started
+113ms ║║Comparison (decimal) -85.0 rises_above (integer) 400 = false (1ms)
+115ms ║║Condition #11 evaluated false (4ms)
+116ms ║║Condition group #10 evaluated false (state did not change) (5ms)
+121ms ║║Comparison (decimal) -85.0 drops_below (integer) -400 = false (1ms)
+122ms ║║Condition #18 evaluated false (4ms)
+123ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+125ms ║╚Execution stage complete. (20ms)
+127ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 4.026s), with 1 more job pending
+140ms ╚Event processed successfully (140ms)
8/14/2019, 8:16:54 PM +645ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -80,1044,-120 with a delay of 143ms
+99ms ║RunTime Analysis CS > 24ms > PS > 40ms > PE > 35ms > CE
+102ms ║Runtime (49853 bytes) successfully initialized in 40ms (v0.3.10e.20190628) (100ms)
+103ms ║╔Execution stage started
+110ms ║║Comparison (decimal) -80.0 rises_above (integer) 400 = false (1ms)
+111ms ║║Condition #11 evaluated false (4ms)
+112ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+117ms ║║Comparison (decimal) -80.0 drops_below (integer) -400 = false (1ms)
+118ms ║║Condition #18 evaluated false (4ms)
+119ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+121ms ║╚Execution stage complete. (18ms)
+122ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 5.033s), with 1 more job pending
+131ms ╚Event processed successfully (131ms)
8/14/2019, 8:16:53 PM +687ms
+2ms ╔Received event [Dryer Sensor].threeAxis = -148,497,-559 with a delay of 208ms
+99ms ║RunTime Analysis CS > 20ms > PS > 43ms > PE > 36ms > CE
+102ms ║Runtime (49852 bytes) successfully initialized in 43ms (v0.3.10e.20190628) (100ms)
+103ms ║╔Execution stage started
+111ms ║║Comparison (decimal) -148.0 rises_above (integer) 400 = false (1ms)
+112ms ║║Condition #11 evaluated false (5ms)
+113ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+119ms ║║Comparison (decimal) -148.0 drops_below (integer) -400 = false (0ms)
+120ms ║║Cancelling condition #18's schedules...
+121ms ║║Condition #18 evaluated false (5ms)
+122ms ║║Condition group #17 evaluated false (state did not change) (6ms)
+124ms ║╚Execution stage complete. (21ms)
+125ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 5.988s), with 1 more job pending
+136ms ╚Event processed successfully (136ms)
8/14/2019, 8:16:52 PM +605ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -782,768,110 with a delay of 134ms
+85ms ║RunTime Analysis CS > 20ms > PS > 31ms > PE > 34ms > CE
+88ms ║Runtime (49851 bytes) successfully initialized in 31ms (v0.3.10e.20190628) (86ms)
+89ms ║╔Execution stage started
+96ms ║║Comparison (decimal) -782.0 rises_above (integer) 400 = false (1ms)
+97ms ║║Condition #11 evaluated false (4ms)
+98ms ║║Condition group #10 evaluated false (state did not change) (5ms)
+108ms ║║Comparison (decimal) -782.0 drops_below (integer) -400 = true (1ms)
+110ms ║║Cancelling condition #18's schedules...
+111ms ║║Condition #18 evaluated true (9ms)
+114ms ║║Comparison (boolean) true is (boolean) false = false (1ms)
+115ms ║║Cancelling condition #40's schedules...
+116ms ║║Condition #40 evaluated false (5ms)
+117ms ║║Condition group #17 evaluated false (state did not change) (17ms)
+120ms ║╚Execution stage complete. (31ms)
+121ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 7.074s), with 1 more job pending
+132ms ╚Event processed successfully (132ms)
8/14/2019, 8:16:51 PM +631ms
+2ms ╔Received event [Dryer Sensor].threeAxis = 106,1016,-466 with a delay of 168ms
+127ms ║RunTime Analysis CS > 28ms > PS > 53ms > PE > 45ms > CE
+129ms ║Runtime (49852 bytes) successfully initialized in 53ms (v0.3.10e.20190628) (126ms)
+130ms ║╔Execution stage started
+138ms ║║Comparison (decimal) 106.0 rises_above (integer) 400 = false (1ms)
+140ms ║║Cancelling condition #11's schedules...
+140ms ║║Condition #11 evaluated false (5ms)
+141ms ║║Condition group #10 evaluated false (state did not change) (7ms)
+147ms ║║Comparison (decimal) 106.0 drops_below (integer) -400 = false (1ms)
+149ms ║║Condition #18 evaluated false (4ms)
+150ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+152ms ║╚Execution stage complete. (22ms)
+154ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 8.016s), with 1 more job pending
+167ms ╚Event processed successfully (167ms)
8/14/2019, 8:16:50 PM +586ms
+1ms ╔Received event [Dryer Sensor].threeAxis = 654,830,-94 with a delay of 138ms
+100ms ║RunTime Analysis CS > 22ms > PS > 41ms > PE > 38ms > CE
+103ms ║Runtime (49850 bytes) successfully initialized in 41ms (v0.3.10e.20190628) (101ms)
+104ms ║╔Execution stage started
+111ms ║║Comparison (decimal) 654.0 rises_above (integer) 400 = true (1ms)
+112ms ║║Cancelling condition #11's schedules...
+113ms ║║Condition #11 evaluated true (5ms)
+117ms ║║Comparison (boolean) false is (boolean) false = true (1ms)
+118ms ║║Condition #12 evaluated true (4ms)
+121ms ║║Comparison (boolean) true is (boolean) false = false (1ms)
+123ms ║║Cancelling condition #39's schedules...
+124ms ║║Condition #39 evaluated false (4ms)
+124ms ║║Condition group #10 evaluated false (state did not change) (17ms)
+130ms ║║Comparison (decimal) 654.0 drops_below (integer) -400 = false (0ms)
+131ms ║║Cancelling condition #18's schedules...
+132ms ║║Condition #18 evaluated false (4ms)
+133ms ║║Cancelling condition #17's schedules...
+133ms ║║Condition group #17 evaluated false (state changed) (7ms)
+136ms ║╚Execution stage complete. (33ms)
+138ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 9.077s), with 1 more job pending
+148ms ╚Event processed successfully (148ms)
8/14/2019, 8:16:49 PM +606ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -975,383,-99 with a delay of 174ms
+102ms ║RunTime Analysis CS > 21ms > PS > 48ms > PE > 34ms > CE
+105ms ║Runtime (49852 bytes) successfully initialized in 48ms (v0.3.10e.20190628) (103ms)
+106ms ║╔Execution stage started
+113ms ║║Comparison (decimal) -975.0 rises_above (integer) 400 = false (1ms)
+114ms ║║Condition #11 evaluated false (4ms)
+115ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+120ms ║║Comparison (decimal) -975.0 drops_below (integer) -400 = true (1ms)
+121ms ║║Cancelling condition #18's schedules...
+122ms ║║Condition #18 evaluated true (5ms)
+125ms ║║Comparison (boolean) false is (boolean) false = true (1ms)
+126ms ║║Condition #40 evaluated true (3ms)
+127ms ║║Cancelling condition #17's schedules...
+128ms ║║Condition group #17 evaluated true (state changed) (11ms)
+133ms ║║Comparison (boolean) true is (boolean) true = true (1ms)
+134ms ║║Cancelling condition #20's schedules...
+135ms ║║Condition #20 evaluated true (5ms)
+136ms ║║Cancelling condition #19's schedules...
+137ms ║║Condition group #19 evaluated true (state changed) (6ms)
+138ms ║║Cancelling statement #26's schedules...
+144ms ║║Executed virtual command setVariable (2ms)
+149ms ║║Executed virtual command setVariable (3ms)
+156ms ║║Calculating (string) Anya is inside. Entered at + (string) 8:16 PM >> (string) Anya is inside. Entered at 8:16 PM
+159ms ║║Calculating (string) Anya is inside. Entered at 8:16 PM + (string) . >> (string) Anya is inside. Entered at 8:16 PM.
+161ms ║║Executed virtual command setState (1ms)
+172ms ║║Calculating (decimal) 1.565835409775E12 - (decimal) 1.565835393317E12 >> (decimal) 16458.0
+178ms ║║Calculating (string) Anya returned at + (string) 8:16 PM >> (string) Anya returned at 8:16 PM
+181ms ║║Calculating (string) Anya returned at 8:16 PM + (string) . She was outside for >> (string) Anya returned at 8:16 PM. She was outside for
+183ms ║║Calculating (string) Anya returned at 8:16 PM. She was outside for + (string) 0 minutes >> (string) Anya returned at 8:16 PM. She was outside for 0 minutes
+185ms ║║Calculating (string) Anya returned at 8:16 PM. She was outside for 0 minutes + (string) . >> (string) Anya returned at 8:16 PM. She was outside for 0 minutes.
+189ms ║║Anya returned at 8:16 PM. She was outside for 0 minutes.
+189ms ║║Executed virtual command log (1ms)
+192ms ║║Executed virtual command wait (0ms)
+193ms ║║Requesting a wake up for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 10.0s)
+198ms ║╚Execution stage complete. (93ms)
+200ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:59 PM MDT (in 9.995s), with 1 more job pending
+208ms ╚Event processed successfully (208ms)
8/14/2019, 8:16:48 PM +702ms
+2ms ╔Received event [Dryer Sensor].threeAxis = -284,853,-409 with a delay of 197ms
+106ms ║RunTime Analysis CS > 21ms > PS > 46ms > PE > 39ms > CE
+109ms ║Runtime (49852 bytes) successfully initialized in 46ms (v0.3.10e.20190628) (107ms)
+110ms ║╔Execution stage started
+118ms ║║Comparison (decimal) -284.0 rises_above (integer) 400 = false (1ms)
+119ms ║║Condition #11 evaluated false (5ms)
+120ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+126ms ║║Comparison (decimal) -284.0 drops_below (integer) -400 = false (1ms)
+128ms ║║Condition #18 evaluated false (5ms)
+129ms ║║Condition group #17 evaluated false (state did not change) (6ms)
+131ms ║╚Execution stage complete. (21ms)
+133ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:21:24 PM MDT (in 275.387s)
+145ms ╚Event processed successfully (145ms)
8/14/2019, 8:16:33 PM +167ms
+1ms ╔Received event [Home].time = 1565835394914 with a delay of -1747ms
+118ms ║RunTime Analysis CS > 27ms > PS > 56ms > PE > 35ms > CE
+122ms ║Runtime (49840 bytes) successfully initialized in 56ms (v0.3.10e.20190628) (119ms)
+123ms ║╔Execution stage started
+143ms ║║Calculating (string) Anya left the house at + (string) 8:16 PM >> (string) Anya left the house at 8:16 PM
+147ms ║║Anya left the house at 8:16 PM
+148ms ║║Executed virtual command log (2ms)
+156ms ║║Executed virtual command setVariable (4ms)
+163ms ║║Executed virtual command setVariable (4ms)
+166ms ║║Cancelling statement #32's schedules...
+438ms ║║Executed physical command [Echo - Living Room Dot].setVolumeAndSpeak([100, Anya has left the building.]) (263ms)
+439ms ║║Executed [Echo - Living Room Dot].setVolumeAndSpeak (265ms)
+448ms ║║Condition #18 evaluated false (7ms)
+449ms ║║Condition group #17 evaluated false (state did not change) (8ms)
+452ms ║╚Execution stage complete. (328ms)
+453ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:21:24 PM MDT (in 290.602s)
+465ms ╚Event processed successfully (465ms)
8/14/2019, 8:16:30 PM +837ms
+2ms ╔Received event [Dryer Sensor].threeAxis = -88,1045,-121 with a delay of 140ms
+105ms ║RunTime Analysis CS > 26ms > PS > 46ms > PE > 33ms > CE
+108ms ║Runtime (49851 bytes) successfully initialized in 46ms (v0.3.10e.20190628) (105ms)
+109ms ║╔Execution stage started
+116ms ║║Comparison (decimal) -88.0 rises_above (integer) 400 = false (0ms)
+117ms ║║Condition #11 evaluated false (4ms)
+118ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+123ms ║║Comparison (decimal) -88.0 drops_below (integer) -400 = false (1ms)
+124ms ║║Condition #18 evaluated false (4ms)
+125ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+127ms ║╚Execution stage complete. (18ms)
+129ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 3.949s), with 1 more job pending
+139ms ╚Event processed successfully (139ms)
8/14/2019, 8:16:29 PM +793ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -99,1044,-122 with a delay of 114ms
+73ms ║RunTime Analysis CS > 14ms > PS > 28ms > PE > 31ms > CE
+76ms ║Runtime (49850 bytes) successfully initialized in 28ms (v0.3.10e.20190628) (74ms)
+77ms ║╔Execution stage started
+84ms ║║Comparison (decimal) -99.0 rises_above (integer) 400 = false (1ms)
+85ms ║║Condition #11 evaluated false (4ms)
+86ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+91ms ║║Comparison (decimal) -99.0 drops_below (integer) -400 = false (1ms)
+93ms ║║Condition #18 evaluated false (4ms)
+94ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+96ms ║╚Execution stage complete. (19ms)
+97ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 5.024s), with 1 more job pending
+110ms ╚Event processed successfully (110ms)
8/14/2019, 8:16:28 PM +807ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -87,1041,-133 with a delay of 148ms
+77ms ║RunTime Analysis CS > 19ms > PS > 30ms > PE > 28ms > CE
+80ms ║Runtime (49851 bytes) successfully initialized in 30ms (v0.3.10e.20190628) (77ms)
+80ms ║╔Execution stage started
+88ms ║║Comparison (decimal) -87.0 rises_above (integer) 400 = false (1ms)
+89ms ║║Condition #11 evaluated false (4ms)
+90ms ║║Condition group #10 evaluated false (state did not change) (6ms)
+95ms ║║Comparison (decimal) -87.0 drops_below (integer) -400 = false (1ms)
+97ms ║║Condition #18 evaluated false (5ms)
+98ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+100ms ║╚Execution stage complete. (20ms)
+102ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 6.006s), with 1 more job pending
+112ms ╚Event processed successfully (112ms)
8/14/2019, 8:16:27 PM +959ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -158,1050,-121 with a delay of 311ms
+74ms ║RunTime Analysis CS > 19ms > PS > 28ms > PE > 27ms > CE
+77ms ║Runtime (49852 bytes) successfully initialized in 28ms (v0.3.10e.20190628) (74ms)
+77ms ║╔Execution stage started
+84ms ║║Comparison (decimal) -158.0 rises_above (integer) 400 = false (1ms)
+86ms ║║Condition #11 evaluated false (5ms)
+87ms ║║Condition group #10 evaluated false (state did not change) (5ms)
+93ms ║║Comparison (decimal) -158.0 drops_below (integer) -400 = false (1ms)
+95ms ║║Condition #18 evaluated false (4ms)
+96ms ║║Condition group #17 evaluated false (state did not change) (5ms)
+98ms ║╚Execution stage complete. (21ms)
+100ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 6.856s), with 1 more job pending
+110ms ╚Event processed successfully (109ms)
8/14/2019, 8:16:26 PM +785ms
+2ms ╔Received event [Dryer Sensor].threeAxis = -298,969,-123 with a delay of 153ms
+104ms ║RunTime Analysis CS > 21ms > PS > 49ms > PE > 34ms > CE
+107ms ║Runtime (49851 bytes) successfully initialized in 49ms (v0.3.10e.20190628) (104ms)
+108ms ║╔Execution stage started
+115ms ║║Comparison (decimal) -298.0 rises_above (integer) 400 = false (1ms)
+117ms ║║Condition #11 evaluated false (4ms)
+117ms ║║Condition group #10 evaluated false (state did not change) (5ms)
+123ms ║║Comparison (decimal) -298.0 drops_below (integer) -400 = false (1ms)
+124ms ║║Condition #18 evaluated false (4ms)
+125ms ║║Condition group #17 evaluated false (state did not change) (6ms)
+127ms ║╚Execution stage complete. (19ms)
+129ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 8.001s), with 1 more job pending
+140ms ╚Event processed successfully (140ms)
8/14/2019, 8:16:25 PM +772ms
+2ms ╔Received event [Dryer Sensor].threeAxis = 524,1699,-784 with a delay of 157ms
+107ms ║RunTime Analysis CS > 27ms > PS > 50ms > PE > 30ms > CE
+110ms ║Runtime (49847 bytes) successfully initialized in 50ms (v0.3.10e.20190628) (107ms)
+111ms ║╔Execution stage started
+117ms ║║Comparison (decimal) 524.0 rises_above (integer) 400 = false (1ms)
+118ms ║║Cancelling condition #11's schedules...
+119ms ║║Condition #11 evaluated false (5ms)
+120ms ║║Cancelling condition #10's schedules...
+121ms ║║Condition group #10 evaluated false (state changed) (6ms)
+125ms ║║Comparison (decimal) 524.0 drops_below (integer) -400 = false (1ms)
+126ms ║║Cancelling condition #18's schedules...
+127ms ║║Condition #18 evaluated false (4ms)
+128ms ║║Cancelling condition #17's schedules...
+129ms ║║Condition group #17 evaluated false (state changed) (7ms)
+131ms ║╚Execution stage complete. (20ms)
+133ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 9.01s), with 1 more job pending
+144ms ╚Event processed successfully (144ms)
8/14/2019, 8:16:24 PM +761ms
+1ms ╔Received event [Dryer Sensor].threeAxis = 787,455,-65 with a delay of 159ms
+102ms ║RunTime Analysis CS > 26ms > PS > 47ms > PE > 30ms > CE
+105ms ║Runtime (49890 bytes) successfully initialized in 47ms (v0.3.10e.20190628) (103ms)
+106ms ║╔Execution stage started
+112ms ║║Comparison (decimal) 787.0 rises_above (integer) 400 = true (1ms)
+114ms ║║Cancelling condition #11's schedules...
+114ms ║║Condition #11 evaluated true (5ms)
+118ms ║║Comparison (boolean) false is (boolean) false = true (1ms)
+119ms ║║Condition #12 evaluated true (4ms)
+122ms ║║Comparison (boolean) false is (boolean) false = true (1ms)
+124ms ║║Condition #39 evaluated true (3ms)
+125ms ║║Cancelling condition #10's schedules...
+125ms ║║Condition group #10 evaluated true (state changed) (16ms)
+127ms ║║Cancelling statement #13's schedules...
+132ms ║║Executed virtual command setVariable (3ms)
+137ms ║║Executed virtual command setVariable (2ms)
+144ms ║║Calculating (string) Anya is outside. Left at + (string) 8:16 PM >> (string) Anya is outside. Left at 8:16 PM
+147ms ║║Calculating (string) Anya is outside. Left at 8:16 PM + (string) . >> (string) Anya is outside. Left at 8:16 PM.
+149ms ║║Executed virtual command setState (1ms)
+152ms ║║Executed virtual command wait (0ms)
+153ms ║║Requesting a wake up for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 10.0s)
+157ms ║╚Execution stage complete. (51ms)
+159ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:16:34 PM MDT (in 9.995s), with 1 more job pending
+171ms ╚Event processed successfully (172ms)
8/14/2019, 8:16:23 PM +837ms
+1ms ╔Received event [Dryer Sensor].threeAxis = -494,1050,-432 with a delay of 171ms
+73ms ║RunTime Analysis CS > 15ms > PS > 32ms > PE > 26ms > CE
+76ms ║Runtime (49852 bytes) successfully initialized in 32ms (v0.3.10e.20190628) (74ms)
+77ms ║╔Execution stage started
+86ms ║║Comparison (decimal) -494.0 rises_above (integer) 400 = false (1ms)
+88ms ║║Condition #11 evaluated false (6ms)
+89ms ║║Condition group #10 evaluated false (state did not change) (7ms)
+95ms ║║Comparison (decimal) -494.0 drops_below (integer) -400 = true (0ms)
+96ms ║║Cancelling condition #18's schedules...
+97ms ║║Condition #18 evaluated true (6ms)
+101ms ║║Comparison (boolean) false is (boolean) false = true (2ms)
+102ms ║║Cancelling condition #40's schedules...
+103ms ║║Condition #40 evaluated true (5ms)
+104ms ║║Cancelling condition #17's schedules...
+105ms ║║Condition group #17 evaluated true (state changed) (14ms)
+110ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+112ms ║║Condition #20 evaluated false (5ms)
+113ms ║║Condition group #19 evaluated false (state did not change) (5ms)
+115ms ║║Cancelling statement #30's schedules...
+128ms ║║Executed physical command [Main Floor Camera Outlet].on() (9ms)
+129ms ║║Executed [Main Floor Camera Outlet].on (11ms)
+131ms ║║Cancelling statement #21's schedules...
+174ms ║║Executed physical command [Dining Room Chandelier].setLevel([100]) (31ms)
+175ms ║║Executed virtual command [Dining Room Chandelier].fadeLevel (38ms)
+247ms ║║Executed physical command [Main Back Patio].setLevel([100]) (67ms)
+248ms ║║Executed virtual command [Main Back Patio].fadeLevel (71ms)
+328ms ║║Executed physical command [Main Kitchen Lights].setLevel([100]) (74ms)
+329ms ║║Executed virtual command [Main Kitchen Lights].fadeLevel (79ms)
+344ms ║║Executed virtual command [Dining Room Chandelier, Main Back Patio, Main Kitchen Lights].sendSMSNotification (10ms)
+357ms ║║Calculating (string) Dog door opened by external person/animal at + (string) 8:16 PM >> (string) Dog door opened by external person/animal at 8:16 PM
+360ms ║║Calculating (string) Dog door opened by external person/animal at 8:16 PM + (string) . >> (string) Dog door opened by external person/animal at 8:16 PM.
+362ms ║║Executed virtual command [Dining Room Chandelier, Main Back Patio, Main Kitchen Lights].setState (1ms)
+372ms ║║Calculating (string) Door opened from outside at + (string) 8:16 PM >> (string) Door opened from outside at 8:16 PM
+375ms ║║Calculating (string) Door opened from outside at 8:16 PM + (string) . Lights have been turned on. >> (string) Door opened from outside at 8:16 PM. Lights have been turned on.
+378ms ║║Door opened from outside at 8:16 PM. Lights have been turned on.
+379ms ║║Executed virtual command [Dining Room Chandelier, Main Back Patio, Main Kitchen Lights].log (1ms)
+383ms ║║Executed virtual command [Dining Room Chandelier, Main Back Patio, Main Kitchen Lights].wait (0ms)
+384ms ║║Requesting a wake up for Wed, Aug 14 2019 @ 8:21:24 PM MDT (in 300.0s)
+388ms ║╚Execution stage complete. (311ms)
+390ms ║Setting up scheduled job for Wed, Aug 14 2019 @ 8:21:24 PM MDT (in 299.995s)
+396ms ╚Event processed successfully (396ms)
8/14/2019, 8:09:40 PM +132ms
+368ms ║Lights turned off.
8/14/2019, 8:04:54 PM +138ms
+8427ms ║Piston waited at a semaphore for 8266ms
8/14/2019, 8:04:52 PM +198ms
+2049ms ║Anya left the house at 8:04 PM
8/14/2019, 8:04:41 PM +14ms
+197ms ║Door opened from outside at 8:04 PM. Lights have been turned on.
8/14/2019, 8:04:13 PM +43ms
+168ms ║Anya returned at 8:04 PM. She was outside for 12 minutes.

#2

Very interesting puzzle, i LOVE IT…
The easier solution would be using 2 sensors BUT you have one now…
I’m going to invite my friend @WCmore for this one and the meanwhile I’ll be thinking about it…


#3

let’s start with the ABOVE part first…(I’m thinking two different pistons actually)

Piston #1 will take care of the dog getting outside…

IF Contact axisx raises above 400
And 
IF Variable @Dogoutside = true
Then 
Set variable @Dogoutside = False
With (Never cancel Task)
Speakers Say this and that
Wait 10 seconds 
Set @dogoutside = true

Piston #2 will take care of the dog getting inside…

IF Contact axisx raises below -400
    And 
    IF Variable @Doginside = true
    Then 
    Set variable @Doginside = False
    With (Never cancel Task)
    Speakers Say this and that
    Wait 10 seconds 
    Set @doginside = true

I don’t have your setup so I can’t test this…This is very close to your original piston and I have a feeling that it might work if you split this and use 2 pistons…


#4

My first thought is to read the door swings separately and log each of the first two swings to a variable that logs current time.
So…
If
axis rises above 400
then
x2 set variable AXabove = {currentEventTime) <–im not sure the actual call
end if
if
axis drops below -400
then
x2 set variable AXbelow = {currentEventTime)
end if

Then change your original two triggers to compare the times of the two variables.
If
AXabove is less than AXbelow
then “dog went outside”
elsif
AXbelow is less than AXabove
and dogoutside = True
then " dog is inside"
else
“Someone done got in the house”

Id set a wait timer after that to allow the door to stop swinging then clear the variables.

This way it can determine which way the door swung first no matter how many times it swings. You might have to play with the cancel policy’s to get this to work.
Thoughts?


#5

Does “current even time” register down to miliseconds?


#6

Thank you, both, for the prompt replies. I’ll try the options and get back to you right away.


#7

I agree wholeheartedly…

Unfortunately, I am booked for the next couple of days, but will share any ideas I have…


My first thought is to capture all the swings in a super short (concise) piston, and then do the logic based on the most extreme number.

Set variable max = max(swing1, swing2, swing3, swing4)
Set variable min = min(swing1, swing2, swing3, swing4)
Set variable diff = max + min

IF {diff} is greater than 0, then the dog went outside
IF {diff} is less than 0, then the dog has entered your house


For example:

If the max is 400, and the min is -200, then 400 + -200 =  200  (Pos / Exiting)
If the max is 200, and the min is -400, then 200 + -400 = -200  (Neg / Entering)

#8

One thing to keep in mind though, is if it is a burglar, it won’t swing for 6-7 seconds as they squirm their way inside…

Actually, now that I think about this, maybe the entire piston can be as simple as:

IF Sensor's axisX stays below 250 for 5 seconds
    Then Intruder alert
END IF

#9

One more idea from my “outside-the-box” thinking…

You could install two cotton balls near the bottom (in the gutter) to minimize the extra swinging…


#10

The Max/Min is an interesting idea, and maybe something I’ll have to explore. I was up way too late last night working on this…but feel like I’m close. I’ll add in the few remaining ideas I had this AM and post my latest before heading to work. Thank you, all, for the extra brain power!


#11

My other thought if you are using a ST open close sensor(which has an Accelerometer). Maybe log the state of the close on the sensor. I suspect that if it roles past the sensor it wont log a closed state again until it comes to rest. So if the sensor was closed and axis went above 400 then you know he went out. And vice versa. It might be an option but you will have to play with it and see what the sensor registers. You will most likely have to put the closed state in a variable as its a condition and the trigger will be the axis move. The piston will only look a the condition state after the trigger. So just write a separate or part of this one where when the sensor comes to rest(closed) change variable to true.


#12

Does anyone know how the integer value of $now works? It was positive yesterday evening, but now it’s negative. I thought maybe it starts negative at midnight and advances to 0 at noon, but that doesn’t appear to be the case. I’m struggling to make the comparison between the two events consistent because of this…


#13

For example:

I just opened the door - pushing it out, which should make @dogDoorAbove record a “lower/earlier” number than @dogDoorBelow (the return swing). This is what I get:

integer@dogDoorSwingAbove -1783772633
integer@dogDoorSwingBelow -1783773581


#14

And here is my latest:

I went with @logeox’s recommendation of creating two pistons: one to store the separate swings and store as two variables: @dogDoorSwingAbove and @dogDoorSwingBelow for swings outside and inside respectively. It then executes a second piston which compares the two values looking for the “oldest” (read: first) swing, and uses that to determine whether the door was first pushed out or in.

The issue I ran into last night (and spent hours trying to troubleshoot) is that the door may not always swing both directions, and therefore may have an old “date/time” value stored, which would throw everything off.

I therefore had to reset both variables to zero after each run.

But then a new issue: if one variable registers a swing, but the other doesn’t and remains at zero, my comparisons are off. So I had to tell the piston to check, and if the “SwingAbove” variable is not zero, but the other is, to make the other variable a value relative to the “real” variable, such that it would read that the door opened first in the direction it did. (I’m sorry—if you followed that explanation, I’m impressed. Short on time).

I think I’m down to just figuring out the proper way to store the $now variable and run conditional logic to see which event happened first - the open out (@dogDoorSwingAbove) or open in (@dogDoorSwingBelow).

Variable-Controlling Piston:

Master/Control Piston:


#15

I do believe I’ve figured it out…took some learnings from a post from @HDGuy here: How to properly handle duplicate events?

See the following. Thank you for your help!


#16

How are you tracking the movement of the dog door? Do you have a multipurpose sensor on it?


#17

Correct—I have a ST multipurpose sensor attached to the upper-portion of the door. It’s secured by Velcro so I can easily remove it and slide in the locking panel when we are out of town. I’ll upload a photo later tonight.


#18

That would be great, thanks! Are you simply using the tilt and not the contact portion?


#19

Correct—I’m using the accelerometer and measuring the x axis to know whether it opened in or out (the door swings both ways), hence the reason for not using the contact sensor. I need to not just know if the door opens, but which way it opens.


#20

That’s a pretty good idea. I also have a dog door and tracking this would be pretty handy. Thanks again for the extra info!