Cancel pending task


#1

I have a simple piston that works to turn lights off in a room after 10 minutes. I have a virtual switch that will prevent the lights being turned off if more than 10 minutes are needed. I’m wondering if there is a way to modify this piston to disable the 10 minute time if the physical switch is turned on.

I’ve tried a few different things but none worked to keep the lights on.

Something that could be affecting my piston is if the door opens a second time, will it restart the process thereby cancelling my physical pressing of the switch?


#2

First, there are many ways to do this. I am not sure how your device is set up, but I sometimes use physically and/or programmatically as conditions to check when I turn devices on/off. But I will mention that some users have had inconsistent results with those commands.


#3

It seems as though using the physical switch does not trigger the piston. It simply turns on or off the light.


#4

Are you on SmartThings or Hubitat? Logs with trace turned on?


#5

I’m on SmartThings. It appears that the “physical change” is not recognized.

[What I’ve Done To Test This]

I created a simple piston that watches for “Switch 1” to turn on. This will happen when either basement door opens. Followed by “Switch 1” physically being turned OFF, followed by “Switch 1” being turned ON.

It will then turn ON “Switch 1” AND “white bulb 3”.

“white bulb 3” is a different wall switch just so I can see if it will work.

[What I Tried]

I opened one of the doors which triggered “Switch 1” ("Switch 1 turned on)

I physically turned OFF “Switch 1” and then turned “Switch 1” back ON

“white bulb 3” did not turn on, which tells me that SmartThings did not detect the physical change in “Switch 1”

I am on SmartThings, not Hubitat.

1/22/2022, 1:32:22 PM +89ms
+0ms ╔Received event [Home].time = 1642876343211 with a delay of -1123ms
+37ms ║RunTime Analysis CS > 19ms > PS > 7ms > PE > 11ms > CE
+39ms ║Runtime (37415 bytes) successfully initialized in 7ms (v0.3.113.20210203) (38ms)
+40ms ║╔Execution stage started
+48ms ║╚Execution stage complete. (9ms)
+52ms ╚Event processed successfully (51ms)
1/22/2022, 1:31:23 PM +196ms
+2ms ╔Received event [Basement Lights].switch = on with a delay of 221ms
+10074ms ║RunTime Analysis CS > 30ms > PS > 10027ms > PE > 16ms > CE
+10075ms ║Piston waited at a semaphore for 10023ms
+10077ms ║Runtime (37499 bytes) successfully initialized in 10027ms (v0.3.113.20210203) (10074ms)
+10078ms ║╔Execution stage started
+10087ms ║║Comparison (enum) on changes_to (string) off = false (1ms)
+10088ms ║║Condition #3 evaluated false (4ms)
+10090ms ║╚Execution stage complete. (13ms)
+10092ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 1:32:23 PM EST (in 49s)
+10103ms ╚Event processed successfully (10103ms)
1/22/2022, 1:31:21 PM +558ms
+2ms ╔Received event [Basement Lights].switch = off with a delay of 188ms
+10064ms ║RunTime Analysis CS > 28ms > PS > 10021ms > PE > 15ms > CE
+10065ms ║Piston waited at a semaphore for 10016ms
+10067ms ║Runtime (37498 bytes) successfully initialized in 10021ms (v0.3.113.20210203) (10064ms)
+10068ms ║╔Execution stage started
+10077ms ║║Comparison (enum) off changes_to (string) off = false (0ms)
+10078ms ║║Condition #3 evaluated false (4ms)
+10080ms ║╚Execution stage complete. (12ms)
+10082ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 1:32:23 PM EST (in 51s)
+10091ms ╚Event processed successfully (10091ms)
1/22/2022, 1:31:23 PM +148ms
+1ms ╔Received event [Basement Lights].switch = on with a delay of 172ms
+47ms ║RunTime Analysis CS > 26ms > PS > 7ms > PE > 14ms > CE
+49ms ║Runtime (37404 bytes) successfully initialized in 7ms (v0.3.113.20210203) (47ms)
+50ms ║╔Execution stage started
+57ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+59ms ║║Cancelling condition #2's schedules...
+60ms ║║Condition #2 evaluated true (6ms)
+61ms ║║Cancelling statement #1's schedules...
+62ms ║║Condition group #1 made progress up the ladder, currently at step 1 of 3
+66ms ║╚Execution stage complete. (17ms)
+67ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 1:32:23 PM EST (in 59s)
+73ms ╚Event processed successfully (73ms)
1/22/2022, 1:31:21 PM +518ms
+1ms ╔Received event [Basement Lights].switch = off with a delay of 148ms
+45ms ║RunTime Analysis CS > 26ms > PS > 7ms > PE > 12ms > CE
+47ms ║Runtime (37404 bytes) successfully initialized in 7ms (v0.3.113.20210203) (45ms)
+48ms ║╔Execution stage started
+56ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+57ms ║║Condition #2 evaluated false (4ms)
+58ms ║║Cancelling statement #1's schedules...
+59ms ║║Condition group #1 evaluated false (state did not change) (7ms)
+61ms ║╚Execution stage complete. (13ms)
+62ms ╚Event processed successfully (62ms)
1/22/2022, 1:31:12 PM +215ms
+1ms ╔Received event [Basement Lights].switch = on with a delay of 196ms
+52ms ║RunTime Analysis CS > 24ms > PS > 15ms > PE > 13ms > CE
+54ms ║Runtime (37405 bytes) successfully initialized in 15ms (v0.3.113.20210203) (52ms)
+55ms ║╔Execution stage started
+62ms ║║Comparison (enum) on changes_to (string) on = false (1ms)
+64ms ║║Condition #2 evaluated false (4ms)
+64ms ║║Cancelling statement #1's schedules...
+65ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+67ms ║╚Execution stage complete. (12ms)
+68ms ╚Event processed successfully (69ms)
1/22/2022, 1:31:12 PM +102ms
+1ms ╔Received event [Basement Lights].switch = on with a delay of 84ms
+34ms ║RunTime Analysis CS > 17ms > PS > 7ms > PE > 10ms > CE
+37ms ║Runtime (37401 bytes) successfully initialized in 7ms (v0.3.113.20210203) (34ms)
+38ms ║╔Execution stage started
+46ms ║║Comparison (enum) on changes_to (string) on = false (0ms)
+47ms ║║Cancelling condition #2's schedules...
+48ms ║║Condition #2 evaluated false (6ms)
+49ms ║║Cancelling statement #1's schedules...
+50ms ║║Condition group #1 evaluated false (state did not change) (8ms)
+52ms ║╚Execution stage complete. (15ms)
+53ms ╚Event processed successfully (53ms)

This is the switch:

[BELOW WITH TRACE ON]

Logs

1/22/2022, 2:02:39 PM +477ms
+1ms ╔Received event [Basement Lights].switch = on with a delay of 150ms
+52ms ║RunTime Analysis CS > 30ms > PS > 9ms > PE > 13ms > CE
+54ms ║Runtime (37405 bytes) successfully initialized in 9ms (v0.3.113.20210203) (52ms)
+55ms ║╔Execution stage started
+63ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+64ms ║║Cancelling condition #2's schedules...
+65ms ║║Condition #2 evaluated true (5ms)
+66ms ║║Cancelling statement #1's schedules...
+67ms ║║Condition group #1 made progress up the ladder, currently at step 1 of 3
+72ms ║╚Execution stage complete. (17ms)
+73ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 2:03:39 PM EST (in 59s)
+79ms ╚Event processed successfully (79ms)

Not as many Log records with trace on…

???

Another try with Logs:

1/22/2022, 2:26:11 PM +153ms
+0ms ╔Received event [Home].time = 1642879571894 with a delay of -742ms
+51ms ║RunTime Analysis CS > 29ms > PS > 8ms > PE > 15ms > CE
+53ms ║Runtime (37414 bytes) successfully initialized in 8ms (v0.3.113.20210203) (52ms)
+54ms ║╔Execution stage started
+80ms ║╚Execution stage complete. (26ms)
+86ms ╚Event processed successfully (86ms)
1/22/2022, 2:25:51 PM +792ms
+2ms ╔Received event [Basement Lights].switch = on with a delay of 194ms
+56ms ║RunTime Analysis CS > 24ms > PS > 16ms > PE > 15ms > CE
+58ms ║Runtime (37418 bytes) successfully initialized in 16ms (v0.3.113.20210203) (55ms)
+59ms ║╔Execution stage started
+67ms ║║Comparison (enum) on changes_to (string) off = false (0ms)
+69ms ║║Condition #3 evaluated false (5ms)
+71ms ║╚Execution stage complete. (12ms)
+72ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 2:26:11 PM EST (in 20s)
+83ms ╚Event processed successfully (82ms)
1/22/2022, 2:25:48 PM +246ms
+1ms ╔Received event [Basement Lights].switch = off with a delay of 204ms
+52ms ║RunTime Analysis CS > 29ms > PS > 8ms > PE > 15ms > CE
+54ms ║Runtime (37416 bytes) successfully initialized in 8ms (v0.3.113.20210203) (51ms)
+55ms ║╔Execution stage started
+64ms ║║Comparison (enum) off changes_to (string) off = false (1ms)
+66ms ║║Condition #3 evaluated false (4ms)
+68ms ║╚Execution stage complete. (14ms)
+69ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 2:26:11 PM EST (in 23s)
+76ms ╚Event processed successfully (77ms)
1/22/2022, 2:25:11 PM +916ms
+1ms ╔Received event [Basement Lights].switch = on with a delay of 154ms
+10052ms ║RunTime Analysis CS > 19ms > PS > 10020ms > PE > 14ms > CE
+10052ms ║Piston waited at a semaphore for 10016ms
+10054ms ║Runtime (37498 bytes) successfully initialized in 10020ms (v0.3.113.20210203) (10052ms)
+10055ms ║╔Execution stage started
+10064ms ║║Comparison (enum) on changes_to (string) off = false (1ms)
+10065ms ║║Condition #3 evaluated false (4ms)
+10067ms ║╚Execution stage complete. (12ms)
+10068ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 2:26:11 PM EST (in 49s)
+10083ms ╚Event processed successfully (10083ms)
1/22/2022, 2:25:11 PM +844ms
+1ms ╔Received event [Basement Lights].switch = on with a delay of 83ms
+33ms ║RunTime Analysis CS > 17ms > PS > 6ms > PE > 10ms > CE
+36ms ║Runtime (37404 bytes) successfully initialized in 6ms (v0.3.113.20210203) (33ms)
+36ms ║╔Execution stage started
+44ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+46ms ║║Cancelling condition #2's schedules...
+47ms ║║Condition #2 evaluated true (6ms)
+48ms ║║Cancelling statement #1's schedules...
+48ms ║║Condition group #1 made progress up the ladder, currently at step 1 of 3
+53ms ║╚Execution stage complete. (17ms)
+54ms ║Setting up scheduled job for Sat, Jan 22 2022 @ 2:26:11 PM EST (in 59s)
+62ms ╚Event processed successfully (61ms)

#6

Whar do the device log/events show?