Motion notification with delay


#1

1) Give a description of the problem
The piston doesn’t test, but it will partially run.

2) What is the expected behavior?
Garage Motion Triggers
Send notification to phone with “Garage Motion + Date and time of trigger”
wait 5 minutes
If still motion after the timer send another notification "“Garage Motion + Date and time of trigger”

3) What is happening/not happening?
I made two pistons to try different methods.
The piston will pause but not resume after the pause. If i use the pause and then resume after a set time it just stays on pause. I also tried to cancel all pending tasks and get the same results.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full) Note - I manually pressed resume after 30ish seconds. In case that isnt clear in the logs.
( Logs

11/1/2018, 11:55:34 PM +730ms
+1ms ╔Starting piston… (v0.3.108.20180906)
+568ms ║╔Subscribing to devices…
+577ms ║║Subscribing to Garage motion.motion…
+663ms ║╚Finished subscribing (100ms)
+698ms ║Comparison (enum) inactive is (string) active = false (3ms)
+700ms ║Cancelling condition #6’s schedules…
+702ms ║Cancelling condition #1’s schedules…
+712ms ╚Piston successfully started (712ms)
11/1/2018, 11:55:00 PM +194ms
+1ms ╔Received event [Garage motion].motion = active with a delay of 96ms
+72ms ║RunTime Analysis CS > 12ms > PS > 42ms > PE > 17ms > CE
+74ms ║Runtime (38148 bytes) successfully initialized in 42ms (v0.3.108.20180906) (72ms)
+75ms ║╔Execution stage started
+87ms ║║Comparison (enum) active is (string) active = true (2ms)
+89ms ║║Cancelling condition #6’s schedules…
+90ms ║║Condition #6 evaluated true (8ms)
+91ms ║║Cancelling condition #1’s schedules…
+92ms ║║Condition group #1 evaluated true (state changed) (11ms)
+95ms ║║Cancelling statement #3’s schedules…
+244ms ║║Executed virtual command [Garage motion].sendPushNotification (141ms)
+487ms ║║Executed virtual command [Garage motion].pausePiston (239ms)
+492ms ║║Executed virtual command [Garage motion].wait (0ms)
+493ms ║║Requesting a wake up for Thu, Nov 1 2018 @ 11:55:10 PM EDT (in 10.0s)
+499ms ║╚Execution stage complete. (424ms)
+501ms ║Setting up scheduled job for Thu, Nov 1 2018 @ 11:55:10 PM EDT (in 9.994s)
+511ms ╚Event processed successfully (511ms)
11/1/2018, 11:55:00 PM +468ms
+80ms ╔Stopping piston…
+201ms ╚Piston successfully stopped (120ms)Preformatted text)


listed #2

#3

The problem you’re having is, after the timer expires your condition is evaluated again. Since “motion sensor is active” is probably no longer true, it evaluates false and the piston does not execute the rest of your commands as written.

One workaround is to use a variable:

Define boolean lightsAutoOn

IF
Motion Sensor 12 is active
THEN
With motion sensor 12
Send push notification
Pause piston xxx
Set variable lightsAutoOn = true

IF
lightsAutoOn = true
THEN
Wait xx time
Resume piston xxx


#4

It has been a long time (12+ years) since I have coded much of anything so pardon me for asking a silly question.

When you reference ‘Define boolean lightsAutoOn’, what exactly is that tied to?

I am assuming its just a placeholder, but my brain is having trouble linking it to my issue. I would like a timer to be set after I get the first notification of 5 minutes before I get another notification in my garage.

WEMO used to have this, but something broke in their recent update and I would prefer to have a more substantial rule system with more detail anyway.

EDIT: I am able to make a timer that notifies me if ‘motion sensor 12’ doesn’t sense motion in one minute. Meaning it waits a minute every time there is motion. It’s not ideal, but it works for now.

Please excuse the message my gf decided was ‘fun’ to use. :speak_no_evil:


#5

This is where we are at now. When Date and time are set in the push notifications, it wont sent me a push message. If its set to anything else like a typed out message, I will get a message. Something is causing a hangup in the sending. The pic is of what doesn’t send a push message.

The logs include starting from the bottom to the top, The bottom logs are from what works, and the top most do not work.

Logs: DOES NOT SENT PUSH :arrow_down:
11/2/2018, 5:03:25 PM +460ms
+1ms ╔Received event [Garage motion].motion = inactive with a delay of 60ms
+2204ms ║RunTime Analysis CS > 13ms > PS > 2163ms > PE > 29ms > CE
+2206ms ║Piston waited at a semaphore for 2118ms
+2208ms ║Runtime (38924 bytes) successfully initialized in 2163ms (v0.3.108.20180906) (2206ms)
+2209ms ║╔Execution stage started
+2222ms ║║Comparison (enum) inactive changes_to (string) active = false (0ms)
+2224ms ║║Condition #2 evaluated false (7ms)
+2225ms ║║Condition group #1 evaluated false (state did not change) (9ms)
+2236ms ║║Comparison (boolean) false stays (boolean) true = false (2ms)
+2239ms ║║Cancelling any timed trigger schedules for condition 9
+2240ms ║║Cancelling statement #9’s schedules…
+2241ms ║║Condition #9 evaluated false (12ms)
+2242ms ║║Condition group #8 evaluated false (state did not change) (14ms)
+2245ms ║╚Execution stage complete. (36ms)
+2247ms ╚Event processed successfully (2246ms)
11/2/2018, 5:03:01 PM +586ms
+1ms ╔Starting piston… (v0.3.108.20180906)
+764ms ║╔Subscribing to devices…
+787ms ║║Subscribing to Garage motion.motion…
+842ms ║╚Finished subscribing (89ms)
+895ms ║Comparison (boolean) false is_not (boolean) true = true (3ms)
+913ms ║Comparison (boolean) false stays (boolean) true = false (3ms)
+916ms ║Cancelling condition #9’s schedules…
+917ms ║Cancelling condition #8’s schedules…
+936ms ╚Piston successfully started (935ms)

PUSH MESSAGE SENDS :arrow_down:

11/2/2018, 5:02:28 PM +96ms
+0ms ╔Received event [Home].time = 1541192548522 with a delay of -427ms
+117ms ║RunTime Analysis CS > 20ms > PS > 71ms > PE > 26ms > CE
+120ms ║Runtime (38994 bytes) successfully initialized in 71ms (v0.3.108.20180906) (119ms)
+121ms ║╔Execution stage started
+139ms ║║Cancelling condition #9's schedules...
+140ms ║║Condition #9 evaluated true (2ms)
+142ms ║║Cancelling condition #8's schedules...
+143ms ║║Condition group #8 evaluated true (state changed) (6ms)
+147ms ║║Cancelling statement #10's schedules...
+157ms ║║Executed virtual command setVariable (5ms)
+161ms ║╚Execution stage complete. (40ms)
+163ms ╚Event processed successfully (162ms)
11/2/2018, 5:01:34 PM +957ms
+1ms ╔Received event [Garage motion].motion = inactive with a delay of 70ms
+94ms ║RunTime Analysis CS > 18ms > PS > 58ms > PE > 18ms > CE
+96ms ║Runtime (38993 bytes) successfully initialized in 58ms (v0.3.108.20180906) (94ms)
+98ms ║╔Execution stage started
+109ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+112ms ║║Cancelling condition #2's schedules...
+113ms ║║Condition #2 evaluated false (7ms)
+114ms ║║Cancelling condition #1's schedules...
+115ms ║║Condition group #1 evaluated false (state changed) (11ms)
+125ms ║║Comparison (boolean) true stays (boolean) true = true (2ms)
+135ms ║║Condition #9 evaluated false (16ms)
+137ms ║║Condition group #8 evaluated false (state did not change) (18ms)
+140ms ║╚Execution stage complete. (43ms)
+143ms ║Setting up scheduled job for Fri, Nov 2 2018 @ 5:02:28 PM EDT (in 53.423s)
+155ms ╚Event processed successfully (155ms)
11/2/2018, 5:01:28 PM +157ms
+2ms ╔Received event [Garage motion].motion = active with a delay of 225ms
+116ms ║RunTime Analysis CS > 19ms > PS > 70ms > PE > 26ms > CE
+120ms ║Runtime (38996 bytes) successfully initialized in 70ms (v0.3.108.20180906) (116ms)
+122ms ║╔Execution stage started
+141ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+144ms ║║Cancelling condition #2's schedules...
+146ms ║║Condition #2 evaluated true (13ms)
+154ms ║║Comparison (boolean) false is_not (boolean) true = true (4ms)
+157ms ║║Cancelling condition #6's schedules...
+159ms ║║Condition #6 evaluated true (11ms)
+161ms ║║Cancelling condition #1's schedules...
+163ms ║║Condition group #1 evaluated true (state changed) (31ms)
+168ms ║║Cancelling statement #3's schedules...
+341ms ║║Executed virtual command sendPushNotification (163ms)
+350ms ║║Executed virtual command setVariable (4ms)
+361ms ║║Comparison (boolean) true stays (boolean) true = true (3ms)
+364ms ║║Adding a timed trigger schedule for condition 9
+367ms ║║Cancelling condition #9's schedules...
+371ms ║║Condition #9 evaluated false (16ms)
+373ms ║║Cancelling condition #8's schedules...
+375ms ║║Condition group #8 evaluated false (state changed) (20ms)
+379ms ║╚Execution stage complete. (258ms)
+382ms ║Setting up scheduled job for Fri, Nov 2 2018 @ 5:02:28 PM EDT (in 59.984s)
+392ms ╚Event processed successfully (392ms)
11/2/2018, 5:01:11 PM +414ms
+0ms ╔Received event [Home].time = 1541192472009 with a delay of -596ms
+253ms ║RunTime Analysis CS > 97ms > PS > 137ms > PE > 19ms > CE
+256ms ║Runtime (38996 bytes) successfully initialized in 137ms (v0.3.108.20180906) (254ms)
+257ms ║╔Execution stage started
+279ms ║║Cancelling condition #9's schedules...
+281ms ║║Condition #9 evaluated true (3ms)
+282ms ║║Cancelling condition #8's schedules...
+283ms ║║Condition group #8 evaluated true (state changed) (6ms)
+289ms ║║Cancelling statement #10's schedules...
+299ms ║║Executed virtual command setVariable (4ms)
+305ms ║╚Execution stage complete. (47ms)
+308ms ╚Event processed successfully (307ms)
11/2/2018, 5:00:47 PM +838ms
+1ms ╔Received event [Garage motion].motion = inactive with a delay of 66ms
+88ms ║RunTime Analysis CS > 16ms > PS > 56ms > PE > 16ms > CE
+90ms ║Runtime (38994 bytes) successfully initialized in 56ms (v0.3.108.20180906) (88ms)
+91ms ║╔Execution stage started
+104ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+106ms ║║Cancelling condition #2's schedules...
+107ms ║║Condition #2 evaluated false (8ms)
+108ms ║║Condition group #1 evaluated false (state did not change) (10ms)
+120ms ║║Comparison (boolean) true stays (boolean) true = true (3ms)
+123ms ║║Condition #9 evaluated false (11ms)
+125ms ║║Condition group #8 evaluated false (state did not change) (13ms)
+130ms ║╚Execution stage complete. (39ms)
+133ms ║Setting up scheduled job for Fri, Nov 2 2018 @ 5:01:12 PM EDT (in 24.039s)
+147ms ╚Event processed successfully (147ms)
11/2/2018, 5:00:41 PM +812ms
+1ms ╔Received event [Garage motion].motion = active with a delay of 62ms
+69ms ║RunTime Analysis CS > 12ms > PS > 44ms > PE > 13ms > CE
+71ms ║Runtime (38995 bytes) successfully initialized in 44ms (v0.3.108.20180906) (69ms)
+73ms ║╔Execution stage started
+85ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+87ms ║║Cancelling condition #2's schedules...
+88ms ║║Condition #2 evaluated true (8ms)
+95ms ║║Comparison (boolean) true is_not (boolean) true = false (2ms)
+97ms ║║Cancelling condition #6's schedules...
+98ms ║║Condition #6 evaluated false (8ms)
+99ms ║║Condition group #1 evaluated false (state did not change) (20ms)
+109ms ║║Comparison (boolean) true stays (boolean) true = true (2ms)
+113ms ║║Condition #9 evaluated false (9ms)
+114ms ║║Condition group #8 evaluated false (state did not change) (11ms)
+117ms ║╚Execution stage complete. (45ms)
+120ms ║Setting up scheduled job for Fri, Nov 2 2018 @ 5:01:12 PM EDT (in 30.079s)
+131ms ╚Event processed successfully (131ms)
11/2/2018, 5:00:16 PM +732ms
+1ms ╔Received event [Garage motion].motion = inactive with a delay of 72ms
+93ms ║RunTime Analysis CS > 20ms > PS > 58ms > PE > 15ms > CE
+96ms ║Runtime (38993 bytes) successfully initialized in 58ms (v0.3.108.20180906) (93ms)
+97ms ║╔Execution stage started
+109ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+111ms ║║Cancelling condition #2's schedules...
+113ms ║║Condition #2 evaluated false (8ms)
+114ms ║║Cancelling condition #1's schedules...
+115ms ║║Condition group #1 evaluated false (state changed) (12ms)
+125ms ║║Comparison (boolean) true stays (boolean) true = true (3ms)
+135ms ║║Condition #9 evaluated false (16ms)
+137ms ║║Condition group #8 evaluated false (state did not change) (18ms)
+140ms ║╚Execution stage complete. (44ms)
+143ms ║Setting up scheduled job for Fri, Nov 2 2018 @ 5:01:12 PM EDT (in 55.136s)
+155ms ╚Event processed successfully (154ms)
11/2/2018, 5:00:11 PM +679ms
+2ms ╔Received event [Garage motion].motion = active with a delay of 75ms
+103ms ║RunTime Analysis CS > 21ms > PS > 60ms > PE > 21ms > CE
+105ms ║Runtime (38998 bytes) successfully initialized in 60ms (v0.3.108.20180906) (102ms)
+107ms ║╔Execution stage started
+119ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+121ms ║║Cancelling condition #2's schedules...
+122ms ║║Condition #2 evaluated true (8ms)
+129ms ║║Comparison (boolean) false is_not (boolean) true = true (2ms)
+131ms ║║Condition #6 evaluated true (7ms)
+132ms ║║Cancelling condition #1's schedules...
+133ms ║║Condition group #1 evaluated true (state changed) (20ms)
+137ms ║║Cancelling statement #3's schedules...
+307ms ║║Executed virtual command sendPushNotification (164ms)
+316ms ║║Executed virtual command setVariable (4ms)
+326ms ║║Comparison (boolean) true stays (boolean) true = true (2ms)
+329ms ║║Adding a timed trigger schedule for condition 9
+332ms ║║Condition #9 evaluated false (12ms)
+334ms ║║Condition group #8 evaluated false (state did not change) (14ms)
+337ms ║╚Execution stage complete. (231ms)
+339ms ║Setting up scheduled job for Fri, Nov 2 2018 @ 5:01:12 PM EDT (in 59.992s)
+350ms ╚Event processed successfully (349ms)