Smart Switch Piston not working


#26

Taking off the $sunset is now always causing the piston execution condition to fail, not sure what time it’s pulling.

Capture

1/1/2018, 9:22:01 PM +563ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 321ms
+132ms ║RunTime Analysis CS > 15ms > PS > 43ms > PE > 75ms > CE
+134ms ║Runtime (38140 bytes) successfully initialized in 43ms (v0.2.101.20171227) (132ms)
+135ms ║╔Execution stage started
+147ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+148ms ║║Cancelling condition #5’s schedules…
+149ms ║║Condition #5 evaluated true (9ms)
+159ms ║║Comparison (datetime) 1514859721713 is_after (datetime) 1514861521695 = false (2ms)
+160ms ║║Condition #18 evaluated false (10ms)
+161ms ║║Condition group #1 evaluated false (state did not change) (21ms)
+163ms ║╚Execution stage complete. (28ms)
+164ms ╚Event processed successfully (164ms)


#27

Change your variable type to date time or dynamic. You can see it’s not accepting the value (says invalid date).


#28

Actually, I think it might be failing because the initial value of nothing (invalid date) is throwing it off.

To get around that, try changing your IF statement to $now IS NOT before (addMinutes(LastRun,30)) and see if that works

Or we can make it so clicking the Test button satisfies the IF statement and populates the LastRun variable so it’s ready to go next time.

If you want a hand with that, post a green shapshot of your piston so I can import it and make a couple quick edits for you to grab back.


#29

I think I have a testable solution but I keep running into this issue of the device get set in a state like on and ST not updating to know that the device was manually turned off.
This image is from the ST device status. I can confirm that this device is turned off. There is also no update on or off in the ST log either. These devices are wifi devices and I know they are still connected to the network.


#30

I just removed the switch in the wemo app, ST, and WebCoRE then added the device to the network and apps again… so far so good.

Here is my updated code which seems to be working as expected (ignore the red, that was me testing to see if I could run it back to back).


#31

Looks good! I’m glad removing and adding the switches was able to fix it… it’s frustrating when you’re working on a piston and something else is (unknowingly) gumming up the works.

I like the logic on your isEmpty… good way to bypass first run issues!


#32

So I’m still running into weird issues: when I start the task everything looks to go fine and the timers get started but the piston runs again because I turn off the device it tells me that it cancels all scheduled which is not what I want. I have tried to make the condition never cancel as well but that does not affect it.

1/3/2018, 10:12:06 PM +880ms
+1ms ╔Received event [Wemo1].switch = off with a delay of 75ms
+99ms ║RunTime Analysis CS > 14ms > PS > 40ms > PE > 46ms > CE
+102ms ║Runtime (40218 bytes) successfully initialized in 40ms (v0.2.101.20171227) (100ms)
+102ms ║╔Execution stage started
+114ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+115ms ║║Cancelling condition #5’s schedules…
+116ms ║║Condition #5 evaluated false (8ms)
+116ms ║║Cancelling condition #1’s schedules…
+117ms ║║Condition group #1 evaluated false (state changed) (11ms)
+120ms ║╚Execution stage complete. (18ms)
+122ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:27:05 PM EST (in 898.077s), with 1 more job pending
+132ms ╚Event processed successfully (131ms)
1/3/2018, 10:12:04 PM +877ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 127ms
+100ms ║RunTime Analysis CS > 14ms > PS > 44ms > PE > 42ms > CE
+102ms ║Runtime (40225 bytes) successfully initialized in 44ms (v0.2.101.20171227) (100ms)
+103ms ║╔Execution stage started
+120ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+121ms ║║Cancelling condition #5’s schedules…
+122ms ║║Condition #5 evaluated true (15ms)
+126ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+127ms ║║Condition #19 evaluated false (4ms)
+132ms ║║Comparison (datetime) 1515035525005 is_after (datetime) 81623152 = true (1ms)
+133ms ║║Condition #20 evaluated true (5ms)
+134ms ║║Condition group #18 evaluated true (state did not change) (11ms)
+134ms ║║Cancelling condition #1’s schedules…
+135ms ║║Condition group #1 evaluated true (state changed) (29ms)
+137ms ║║Cancelling statement #16’s schedules…
+141ms ║║Executed virtual command setVariable (2ms)
+143ms ║║Cancelling statement #6’s schedules…
+165ms ║║Executed physical command [Wemo2].on() (20ms)
+166ms ║║Executed [Wemo2].on (21ms)
+169ms ║║Executed virtual command [Wemo2].wait (0ms)
+170ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:42:05 PM EST (in 1800.0s)
+173ms ║║Cancelling statement #10’s schedules…
+197ms ║║Executed physical command [Wemo1].off() (21ms)
+197ms ║║Executed [Wemo1].off (22ms)
+199ms ║║Executed virtual command [Wemo1].wait (0ms)
+200ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:27:05 PM EST (in 900.0s)
+204ms ║╚Execution stage complete. (101ms)
+205ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:27:05 PM EST (in 899.996s), with 1 more job pending
+239ms ╚Event processed successfully (239ms)


Garade door open (via Presence or not) and also the lights only if is night
#33

I’m not sure ‘cancelling schedules’ in the log necessarily means it’s cancelling pending tasks. I see “cancelling schedules” in the log after nearly every condition in my pistons. Have you let the piston run its course to see if it continues?

It might be worth setting your wait times down, setting your WITH statements to “never cancel tasks”, and seeing in the behavior is what you want it to be.


#34

Yes, it does look lit it still running, it so confusing on the pending tasks vs schedules. I don’t know the difference.

Also find a weird issue with the datatime. In the picture at the bottom right you can see the LastRun being a day in the future at 10:19pm but as soon as I click the edit button on the variable the box at the top shows up. At first I thought it might have been a UTC vs EST but nope…


#35

I’ve never understood it either. What I’ve been doing is just ignoring “cancelling schedules” in the log file… if you see “cancelling pending tasks” then the piston is actively cancelling something it was doing.

That’s an odd one on the variable! I don’t suppose when you clicked on the “edit variable” the time in the edit box was the current time?


#36

As a matter of fact the edit box is the current time. The current time makes sense but the 1 day in advance is a little bit harder to swallow.


#37

Yep, I think that’s just a product of us setting it to $now - which gets updated to the current time every time you open your piston.

What value shows in the green text next to LastRun when you’re viewing your piston (not in the edit window)? Is it a day ahead of time too?


#38

So it can show the correct date but if I run it several time in a row the time goes to 24 hours in advance. It says at 24hrs in advance but it changes the second / minute to when I push the button again. Which is also weird because the setting of the variable doesn’t happen… so why does the LastRun variable get updated.


#39

I know this is a lot but this is me pressing the button on the switch several times because I found it weird. You can also see I have bolded where addMinute(LastRun, 30) evaluates to something like 1972.

1/3/2018, 10:57:11 PM +247ms
+0ms ╔Received event [Wemo1].switch = off with a delay of 188ms
+132ms ║RunTime Analysis CS > 18ms > PS > 36ms > PE > 79ms > CE
+135ms ║Runtime (40221 bytes) successfully initialized in 36ms (v0.2.101.20171227) (134ms)
+136ms ║╔Execution stage started
+149ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+151ms ║║Cancelling condition #5’s schedules…
+152ms ║║Condition #5 evaluated false (11ms)
+152ms ║║Cancelling condition #1’s schedules…
+153ms ║║Condition group #1 evaluated false (state changed) (14ms)
+156ms ║╚Execution stage complete. (20ms)
+157ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:12:10 PM EST (in 899.377s), with 1 more job pending
+167ms ╚Event processed successfully (167ms)
1/3/2018, 10:57:10 PM +561ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 89ms
+137ms ║RunTime Analysis CS > 15ms > PS > 47ms > PE > 76ms > CE
+140ms ║Runtime (40225 bytes) successfully initialized in 47ms (v0.2.101.20171227) (139ms)
+140ms ║╔Execution stage started
+152ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+153ms ║║Cancelling condition #5’s schedules…
+153ms ║║Condition #5 evaluated true (9ms)
+158ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+159ms ║║Condition #19 evaluated false (5ms)
+168ms ║║Comparison (datetime) 1515038230721 is_after (datetime) 84287314 = true (2ms)
+169ms ║║Condition #20 evaluated true (9ms)
+170ms ║║Condition group #18 evaluated true (state did not change) (16ms)
+170ms ║║Cancelling condition #1’s schedules…
+171ms ║║Condition group #1 evaluated true (state changed) (27ms)
+173ms ║║Cancelling statement #16’s schedules…
+177ms ║║Executed virtual command setVariable (2ms)
+180ms ║║Cancelling statement #6’s schedules…
+184ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (3ms)
+184ms ║║Executed [Wemo2].on (3ms)
+187ms ║║Executed virtual command [Wemo2].wait (1ms)
+188ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:27:10 PM EST (in 1800.0s)
+191ms ║║Cancelling statement #10’s schedules…
+215ms ║║Executed physical command [Wemo1].off() (22ms)
+216ms ║║Executed [Wemo1].off (22ms)
+218ms ║║Executed virtual command [Wemo1].wait (1ms)
+219ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:12:10 PM EST (in 900.0s)
+223ms ║╚Execution stage complete. (83ms)
+224ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:12:10 PM EST (in 899.995s), with 1 more job pending
+233ms ╚Event processed successfully (233ms)
1/3/2018, 10:54:48 PM +118ms
+1ms ╔Received event [Wemo1].switch = off with a delay of 139ms
+160ms ║RunTime Analysis CS > 19ms > PS > 65ms > PE > 77ms > CE
+162ms ║Runtime (40221 bytes) successfully initialized in 65ms (v0.2.101.20171227) (160ms)
+163ms ║╔Execution stage started
+175ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+183ms ║║Cancelling condition #5’s schedules…
+185ms ║║Condition #5 evaluated false (19ms)
+186ms ║║Cancelling condition #1’s schedules…
+187ms ║║Condition group #1 evaluated false (state changed) (21ms)
+190ms ║╚Execution stage complete. (27ms)
+192ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:09:47 PM EST (in 899.047s), with 1 more job pending
+201ms ╚Event processed successfully (201ms)
1/3/2018, 10:54:47 PM +147ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 224ms
+125ms ║RunTime Analysis CS > 18ms > PS > 34ms > PE > 73ms > CE
+128ms ║Runtime (40226 bytes) successfully initialized in 34ms (v0.2.101.20171227) (127ms)
+129ms ║╔Execution stage started
+144ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+145ms ║║Cancelling condition #5’s schedules…
+146ms ║║Condition #5 evaluated true (13ms)
+153ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+155ms ║║Condition #19 evaluated false (7ms)
+160ms ║║Comparison (datetime) 1515038087303 is_after (datetime) 84266692 = true (1ms)
+161ms ║║Condition #20 evaluated true (6ms)
+162ms ║║Condition group #18 evaluated true (state did not change) (15ms)
+163ms ║║Cancelling condition #1’s schedules…
+164ms ║║Condition group #1 evaluated true (state changed) (31ms)
+166ms ║║Cancelling statement #16’s schedules…
+171ms ║║Executed virtual command setVariable (3ms)
+173ms ║║Cancelling statement #6’s schedules…
+178ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (3ms)
+179ms ║║Executed [Wemo2].on (5ms)
+183ms ║║Executed virtual command [Wemo2].wait (0ms)
+184ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:24:47 PM EST (in 1800.0s)
+188ms ║║Cancelling statement #10’s schedules…
+205ms ║║Executed physical command [Wemo1].off() (15ms)
+205ms ║║Executed [Wemo1].off (16ms)
+208ms ║║Executed virtual command [Wemo1].wait (1ms)
+209ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:09:47 PM EST (in 900.0s)
+213ms ║╚Execution stage complete. (85ms)
+215ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:09:47 PM EST (in 899.995s), with 1 more job pending
+223ms ╚Event processed successfully (223ms)
1/3/2018, 10:54:27 PM +387ms
+2ms ╔Received event [Wemo1].switch = off with a delay of 396ms
+151ms ║RunTime Analysis CS > 20ms > PS > 53ms > PE > 77ms > CE
+153ms ║Runtime (40221 bytes) successfully initialized in 53ms (v0.2.101.20171227) (151ms)
+154ms ║╔Execution stage started
+274ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+276ms ║║Cancelling condition #5’s schedules…
+276ms ║║Condition #5 evaluated false (9ms)
+277ms ║║Cancelling condition #1’s schedules…
+278ms ║║Condition group #1 evaluated false (state changed) (11ms)
+280ms ║╚Execution stage complete. (126ms)
+282ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:09:26 PM EST (in 899.088s), with 1 more job pending
+290ms ╚Event processed successfully (290ms)
1/3/2018, 10:54:26 PM +518ms
+2ms ╔Received event [Wemo1].switch = on with a delay of 235ms
+140ms ║RunTime Analysis CS > 16ms > PS > 52ms > PE > 72ms > CE
+143ms ║Runtime (40226 bytes) successfully initialized in 52ms (v0.2.101.20171227) (141ms)
+144ms ║╔Execution stage started
+155ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+156ms ║║Cancelling condition #5’s schedules…
+157ms ║║Condition #5 evaluated true (9ms)
+162ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+163ms ║║Condition #19 evaluated false (4ms)
+168ms ║║Comparison (datetime) 1515038066682 is_after (datetime) 84199185 = true (2ms)
+169ms ║║Condition #20 evaluated true (6ms)
+170ms ║║Condition group #18 evaluated true (state did not change) (12ms)
+171ms ║║Cancelling condition #1’s schedules…
+171ms ║║Condition group #1 evaluated true (state changed) (24ms)
+173ms ║║Cancelling statement #16’s schedules…
+179ms ║║Executed virtual command setVariable (3ms)
+181ms ║║Cancelling statement #6’s schedules…
+194ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (3ms)
+196ms ║║Executed [Wemo2].on (14ms)
+200ms ║║Executed virtual command [Wemo2].wait (0ms)
+202ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:24:26 PM EST (in 1800.0s)
+205ms ║║Cancelling statement #10’s schedules…
+233ms ║║Executed physical command [Wemo1].off() (25ms)
+234ms ║║Executed [Wemo1].off (27ms)
+236ms ║║Executed virtual command [Wemo1].wait (0ms)
+237ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:09:26 PM EST (in 900.0s)
+241ms ║╚Execution stage complete. (98ms)
+243ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:09:26 PM EST (in 899.996s), with 1 more job pending
+252ms ╚Event processed successfully (252ms)
1/3/2018, 10:53:20 PM +321ms
+2ms ╔Received event [Wemo1].switch = off with a delay of 128ms
+150ms ║RunTime Analysis CS > 23ms > PS > 57ms > PE > 70ms > CE
+152ms ║Runtime (40221 bytes) successfully initialized in 57ms (v0.2.101.20171227) (150ms)
+153ms ║╔Execution stage started
+166ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+167ms ║║Cancelling condition #5’s schedules…
+168ms ║║Condition #5 evaluated false (11ms)
+169ms ║║Cancelling condition #1’s schedules…
+169ms ║║Condition group #1 evaluated false (state changed) (12ms)
+172ms ║╚Execution stage complete. (19ms)
+173ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:08:19 PM EST (in 898.751s), with 1 more job pending
+184ms ╚Event processed successfully (184ms)
1/3/2018, 10:53:19 PM +16ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 234ms
+134ms ║RunTime Analysis CS > 16ms > PS > 50ms > PE > 68ms > CE
+136ms ║Runtime (40226 bytes) successfully initialized in 50ms (v0.2.101.20171227) (134ms)
+137ms ║╔Execution stage started
+149ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+150ms ║║Cancelling condition #5’s schedules…
+151ms ║║Condition #5 evaluated true (10ms)
+156ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+157ms ║║Condition #19 evaluated false (5ms)
+162ms ║║Comparison (datetime) 1515037999174 is_after (datetime) 84172755 = true (1ms)
+163ms ║║Condition #20 evaluated true (6ms)
+164ms ║║Condition group #18 evaluated true (state did not change) (13ms)
+165ms ║║Cancelling condition #1’s schedules…
+166ms ║║Condition group #1 evaluated true (state changed) (25ms)
+168ms ║║Cancelling statement #16’s schedules…
+173ms ║║Executed virtual command setVariable (3ms)
+175ms ║║Cancelling statement #6’s schedules…
+181ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (4ms)
+181ms ║║Executed [Wemo2].on (5ms)
+184ms ║║Executed virtual command [Wemo2].wait (1ms)
+185ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:23:19 PM EST (in 1800.0s)
+188ms ║║Cancelling statement #10’s schedules…
+224ms ║║Executed physical command [Wemo1].off() (33ms)
+225ms ║║Executed [Wemo1].off (34ms)
+228ms ║║Executed virtual command [Wemo1].wait (1ms)
+229ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:08:19 PM EST (in 900.0s)
+233ms ║╚Execution stage complete. (96ms)
+234ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:08:19 PM EST (in 899.995s), with 1 more job pending
+319ms ╚Event processed successfully (319ms)
1/3/2018, 10:52:54 PM +147ms
+1ms ╔Received event [Wemo1].switch = off with a delay of 156ms
+135ms ║RunTime Analysis CS > 22ms > PS > 50ms > PE > 63ms > CE
+137ms ║Runtime (40221 bytes) successfully initialized in 50ms (v0.2.101.20171227) (135ms)
+138ms ║╔Execution stage started
+150ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+151ms ║║Cancelling condition #5’s schedules…
+152ms ║║Condition #5 evaluated false (9ms)
+152ms ║║Cancelling condition #1’s schedules…
+153ms ║║Condition group #1 evaluated false (state changed) (11ms)
+156ms ║╚Execution stage complete. (18ms)
+158ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:07:52 PM EST (in 898.502s), with 1 more job pending
+167ms ╚Event processed successfully (166ms)
1/3/2018, 10:52:52 PM +589ms
+2ms ╔Received event [Wemo1].switch = on with a delay of 107ms
+131ms ║RunTime Analysis CS > 16ms > PS > 51ms > PE > 64ms > CE
+133ms ║Runtime (40226 bytes) successfully initialized in 51ms (v0.2.101.20171227) (131ms)
+134ms ║╔Execution stage started
+146ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+148ms ║║Cancelling condition #5’s schedules…
+148ms ║║Condition #5 evaluated true (10ms)
+153ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+154ms ║║Condition #19 evaluated false (5ms)
+160ms ║║Comparison (datetime) 1515037972745 is_after (datetime) 84155351 = true (2ms)
+161ms ║║Condition #20 evaluated true (6ms)
+162ms ║║Condition group #18 evaluated true (state did not change) (13ms)
+163ms ║║Cancelling condition #1’s schedules…
+163ms ║║Condition group #1 evaluated true (state changed) (25ms)
+165ms ║║Cancelling statement #16’s schedules…
+170ms ║║Executed virtual command setVariable (2ms)
+173ms ║║Cancelling statement #6’s schedules…
+177ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (3ms)
+177ms ║║Executed [Wemo2].on (3ms)
+180ms ║║Executed virtual command [Wemo2].wait (0ms)
+181ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:22:52 PM EST (in 1800.0s)
+184ms ║║Cancelling statement #10’s schedules…
+212ms ║║Executed physical command [Wemo1].off() (25ms)
+213ms ║║Executed [Wemo1].off (26ms)
+215ms ║║Executed virtual command [Wemo1].wait (0ms)
+216ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:07:52 PM EST (in 900.0s)
+220ms ║╚Execution stage complete. (86ms)
+222ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:07:52 PM EST (in 899.996s), with 1 more job pending
+233ms ╚Event processed successfully (233ms)
1/3/2018, 10:52:36 PM +344ms
+2ms ╔Received event [Wemo1].switch = off with a delay of 362ms
+140ms ║RunTime Analysis CS > 16ms > PS > 61ms > PE > 63ms > CE
+143ms ║Runtime (40221 bytes) successfully initialized in 61ms (v0.2.101.20171227) (140ms)
+144ms ║╔Execution stage started
+156ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+157ms ║║Cancelling condition #5’s schedules…
+157ms ║║Condition #5 evaluated false (9ms)
+158ms ║║Cancelling condition #1’s schedules…
+159ms ║║Condition group #1 evaluated false (state changed) (11ms)
+162ms ║╚Execution stage complete. (18ms)
+163ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:07:35 PM EST (in 898.904s), with 1 more job pending
+173ms ╚Event processed successfully (173ms)
1/3/2018, 10:52:35 PM +181ms
+2ms ╔Received event [Wemo1].switch = on with a delay of 167ms
+137ms ║RunTime Analysis CS > 16ms > PS > 53ms > PE > 68ms > CE
+139ms ║Runtime (40226 bytes) successfully initialized in 53ms (v0.2.101.20171227) (137ms)
+140ms ║╔Execution stage started
+152ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+153ms ║║Cancelling condition #5’s schedules…
+154ms ║║Condition #5 evaluated true (10ms)
+158ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+159ms ║║Condition #19 evaluated false (4ms)
+164ms ║║Comparison (datetime) 1515037955341 is_after (datetime) 84043569 = true (1ms)
+165ms ║║Condition #20 evaluated true (5ms)
+166ms ║║Condition group #18 evaluated true (state did not change) (12ms)
+167ms ║║Cancelling condition #1’s schedules…
+167ms ║║Condition group #1 evaluated true (state changed) (23ms)
+169ms ║║Cancelling statement #16’s schedules…
+174ms ║║Executed virtual command setVariable (3ms)
+176ms ║║Cancelling statement #6’s schedules…
+181ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (4ms)
+182ms ║║Executed [Wemo2].on (5ms)
+184ms ║║Executed virtual command [Wemo2].wait (0ms)
+191ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:22:35 PM EST (in 1800.0s)
+198ms ║║Cancelling statement #10’s schedules…
+225ms ║║Executed physical command [Wemo1].off() (24ms)
+226ms ║║Executed [Wemo1].off (26ms)
+228ms ║║Executed virtual command [Wemo1].wait (0ms)
+229ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:07:35 PM EST (in 900.0s)
+233ms ║╚Execution stage complete. (93ms)
+234ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:07:35 PM EST (in 899.996s), with 1 more job pending
+246ms ╚Event processed successfully (246ms)
1/3/2018, 10:50:45 PM +378ms
+1ms ╔Received event [Wemo1].switch = off with a delay of 118ms
+131ms ║RunTime Analysis CS > 20ms > PS > 53ms > PE > 58ms > CE
+133ms ║Runtime (40221 bytes) successfully initialized in 53ms (v0.2.101.20171227) (131ms)
+134ms ║╔Execution stage started
+146ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+147ms ║║Cancelling condition #5’s schedules…
+148ms ║║Condition #5 evaluated false (10ms)
+149ms ║║Cancelling condition #1’s schedules…
+149ms ║║Condition group #1 evaluated false (state changed) (11ms)
+153ms ║╚Execution stage complete. (19ms)
+155ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:05:43 PM EST (in 898.082s), with 1 more job pending
+163ms ╚Event processed successfully (163ms)
1/3/2018, 10:50:43 PM +429ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 154ms
+108ms ║RunTime Analysis CS > 14ms > PS > 43ms > PE > 51ms > CE
+111ms ║Runtime (40221 bytes) successfully initialized in 43ms (v0.2.101.20171227) (109ms)
+111ms ║╔Execution stage started
+123ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+124ms ║║Condition #5 evaluated true (9ms)
+128ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+129ms ║║Condition #19 evaluated false (4ms)
+135ms ║║Comparison (datetime) 1515037843560 is_after (datetime) 82190869 = true (1ms)
+136ms ║║Condition #20 evaluated true (6ms)
+136ms ║║Condition group #18 evaluated true (state did not change) (11ms)
+137ms ║║Condition group #1 evaluated true (state did not change) (22ms)
+139ms ║║Cancelling statement #16’s schedules…
+144ms ║║Executed virtual command setVariable (3ms)
+146ms ║║Cancelling statement #6’s schedules…
+150ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (2ms)
+150ms ║║Executed [Wemo2].on (3ms)
+153ms ║║Executed virtual command [Wemo2].wait (1ms)
+154ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:20:43 PM EST (in 1800.0s)
+157ms ║║Cancelling statement #10’s schedules…
+181ms ║║Executed physical command [Wemo1].off() (22ms)
+182ms ║║Executed [Wemo1].off (23ms)
+184ms ║║Executed virtual command [Wemo1].wait (0ms)
+185ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 11:05:43 PM EST (in 900.0s)
+188ms ║╚Execution stage complete. (77ms)
+190ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 11:05:43 PM EST (in 899.996s), with 1 more job pending
+296ms ╚Event processed successfully (296ms)
1/3/2018, 10:49:50 PM +465ms
+0ms ╔Received event [Home].time = 1515037790886 with a delay of -422ms
+102ms ║RunTime Analysis CS > 20ms > PS > 30ms > PE > 48ms > CE
+105ms ║Runtime (40230 bytes) successfully initialized in 30ms (v0.2.101.20171227) (104ms)
+106ms ║╔Execution stage started
+137ms ║║Executed physical command [Wemo2].off() (17ms)
+137ms ║║Executed [Wemo2].off (19ms)
+139ms ║╚Execution stage complete. (34ms)
+140ms ╚Event processed successfully (140ms)
1/3/2018, 10:49:48 PM +325ms
+1ms ╔Received event [Home].time = 1515037789583 with a delay of -1258ms
+134ms ║RunTime Analysis CS > 16ms > PS > 60ms > PE > 58ms > CE
+137ms ║Runtime (40231 bytes) successfully initialized in 60ms (v0.2.101.20171227) (135ms)
+137ms ║╔Execution stage started
+156ms ║║Skipped execution of physical command [Wemo1].off([]) because it would make no change to the device. (4ms)
+156ms ║║Executed [Wemo1].off (4ms)
+159ms ║╚Execution stage complete. (21ms)
+160ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:49:50 PM EST (in 2.402s)
+173ms ╚Event processed successfully (172ms)
1/3/2018, 10:34:49 PM +336ms
+1ms ╔Received event [Home].time = 1515036890897 with a delay of -1561ms
+199ms ║RunTime Analysis CS > 14ms > PS > 43ms > PE > 142ms > CE
+201ms ║Runtime (40230 bytes) successfully initialized in 43ms (v0.2.101.20171227) (200ms)
+202ms ║╔Execution stage started
+236ms ║║Executed physical command [Wemo1].on() (20ms)
+237ms ║║Executed [Wemo1].on (22ms)
+241ms ║║Executed virtual command [Wemo1].wait (2ms)
+246ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:49:49 PM EST (in 900.0s)
+252ms ║╚Execution stage complete. (49ms)
+253ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:49:49 PM EST (in 899.994s), with 1 more job pending
+261ms ╚Event processed successfully (261ms)
1/3/2018, 10:19:50 PM +734ms
+1ms ╔Received event [Wemo2].switch = on with a delay of 119ms
+103ms ║RunTime Analysis CS > 13ms > PS > 44ms > PE > 45ms > CE
+105ms ║Runtime (40225 bytes) successfully initialized in 44ms (v0.2.101.20171227) (103ms)
+106ms ║╔Execution stage started
+116ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+117ms ║║Cancelling condition #5’s schedules…
+118ms ║║Condition #5 evaluated true (9ms)
+122ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+123ms ║║Condition #19 evaluated false (4ms)
+129ms ║║Comparison (datetime) 1515035990858 is_after (datetime) 81725015 = true (2ms)
+130ms ║║Condition #20 evaluated true (6ms)
+130ms ║║Condition group #18 evaluated true (state did not change) (12ms)
+131ms ║║Cancelling condition #1’s schedules…
+132ms ║║Condition group #1 evaluated true (state changed) (23ms)
+134ms ║║Cancelling statement #16’s schedules…
+139ms ║║Executed virtual command setVariable (2ms)
+141ms ║║Cancelling statement #6’s schedules…
+144ms ║║Skipped execution of physical command [Wemo2].on([]) because it would make no change to the device. (1ms)
+144ms ║║Executed [Wemo2].on (1ms)
+147ms ║║Executed virtual command [Wemo2].wait (1ms)
+152ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:49:50 PM EST (in 1800.0s)
+155ms ║║Cancelling statement #10’s schedules…
+159ms ║║Skipped execution of physical command [Wemo1].off([]) because it would make no change to the device. (2ms)
+160ms ║║Executed [Wemo1].off (4ms)
+162ms ║║Executed virtual command [Wemo1].wait (0ms)
+163ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:34:50 PM EST (in 900.0s)
+167ms ║╚Execution stage complete. (62ms)
+169ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:34:50 PM EST (in 899.995s), with 1 more job pending
+179ms ╚Event processed successfully (179ms)
1/3/2018, 10:12:06 PM +880ms
+1ms ╔Received event [Wemo1].switch = off with a delay of 75ms
+99ms ║RunTime Analysis CS > 14ms > PS > 40ms > PE > 46ms > CE
+102ms ║Runtime (40218 bytes) successfully initialized in 40ms (v0.2.101.20171227) (100ms)
+102ms ║╔Execution stage started
+114ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+115ms ║║Cancelling condition #5’s schedules…
+116ms ║║Condition #5 evaluated false (8ms)
+116ms ║║Cancelling condition #1’s schedules…
+117ms ║║Condition group #1 evaluated false (state changed) (11ms)
+120ms ║╚Execution stage complete. (18ms)
+122ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:27:05 PM EST (in 898.077s), with 1 more job pending
+132ms ╚Event processed successfully (131ms)
1/3/2018, 10:12:04 PM +877ms
+1ms ╔Received event [Wemo1].switch = on with a delay of 127ms
+100ms ║RunTime Analysis CS > 14ms > PS > 44ms > PE > 42ms > CE
+102ms ║Runtime (40225 bytes) successfully initialized in 44ms (v0.2.101.20171227) (100ms)
+103ms ║╔Execution stage started
+120ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+121ms ║║Cancelling condition #5’s schedules…
+122ms ║║Condition #5 evaluated true (15ms)
+126ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+127ms ║║Condition #19 evaluated false (4ms)
+132ms ║║Comparison (datetime) 1515035525005 is_after (datetime) 81623152 = true (1ms)
+133ms ║║Condition #20 evaluated true (5ms)
+134ms ║║Condition group #18 evaluated true (state did not change) (11ms)
+134ms ║║Cancelling condition #1’s schedules…
+135ms ║║Condition group #1 evaluated true (state changed) (29ms)
+137ms ║║Cancelling statement #16’s schedules…
+141ms ║║Executed virtual command setVariable (2ms)
+143ms ║║Cancelling statement #6’s schedules…
+165ms ║║Executed physical command [Wemo2].on() (20ms)
+166ms ║║Executed [Wemo2].on (21ms)
+169ms ║║Executed virtual command [Wemo2].wait (0ms)
+170ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:42:05 PM EST (in 1800.0s)
+173ms ║║Cancelling statement #10’s schedules…
+197ms ║║Executed physical command [Wemo1].off() (21ms)
+197ms ║║Executed [Wemo1].off (22ms)
+199ms ║║Executed virtual command [Wemo1].wait (0ms)
+200ms ║║Requesting a wake up for Wed, Jan 3 2018 @ 10:27:05 PM EST (in 900.0s)
+204ms ║╚Execution stage complete. (101ms)
+205ms ║Setting up scheduled job for Wed, Jan 3 2018 @ 10:27:05 PM EST (in 899.996s), with 1 more job pending
+239ms ╚Event processed successfully (239ms)


#40

I’m going to import the piston you posted above and see if I can figure out what’s going on.


#41

Ok, I can’t explain why a variable labeled datetime doesn’t play nicely with a system variable with the same label ($now is datetime)… but after some playing around I was able to prove this out and see the lockout working repeatably and reliably.


Timer keeps restarting within speaker volume control
#42

Ok, it looks like you moved the addMinute to the then section and you changed the variable type to long. I make the change and give it a try.

Do have a way to run a check and/or cancel all previously running piston instances?


#43

To simplify testing, I changed addMinutes to addSeconds, and changed “if any light switch changes to on” to “if $currentEventAttribute is test”. That way you can just click the test button at the bottom of the piston to execute it, confirm it locks out for 10, 20, 30 seconds or whatever you set it to, then allows the piston to execute again after time lapses.

I can’t say I understand why our original approach didn’t work, but can confirm this approach does. Even if the date format saved in TimeOut is a little harder for us to read.


#44

Sounds good. Oh you mentioned a lock out… can I actually lock a piston from running for a period of time once it activates? That would be pretty cool.

I’d also like to look at adding a condition to see if there is already a running piston or scheduled to run piston that way I don’t start multiple timers.


How to Limit Automations to Once-Per-Period-Of-Time? (when the start-time for the period is dynamic; i.e. based on an event)
#45

You can pause a piston, then resume it (from another piston - not from itself). But by lockout I just meant our TimeOut variable that, through a condition, prevents it from passing the IF condition for a defined period of time. That’s the easiest way to do it… that I’ve found, anyway.