Trying to set up an interrupt


#21

The latest version will only trigger once per day at 107pm. For testing purposes I usually create another condition that says “If $currentEventAttribute is test”… That way you can just click test to exercise your piston and sort out bugs.


#22

How do I click Test?


#23

Oh do you mean the “Test” at the bottom of the piston?


#24

OK I did that and ran it again. Here is the log. The light went to 2% and then seemed to stop.

1/20/2018, 5:37:00 PM +349ms
+1ms ╔Received event [Tom’s Light].switch = off with a delay of 891ms
+84ms ║RunTime Analysis CS > 20ms > PS > 41ms > PE > 24ms > CE
+87ms ║Runtime (40474 bytes) successfully initialized in 41ms (v0.2.102.20180116) (85ms)
+88ms ║╔Execution stage started
+99ms ║║Comparison (string) switch is (string) test = false (2ms)
+101ms ║║Cancelling condition #12’s schedules…
+102ms ║║Condition #12 evaluated false (6ms)
+103ms ║║Cancelling condition #1’s schedules…
+104ms ║║Condition group #1 evaluated false (state changed) (9ms)
+111ms ║║Comparison (enum) off changes_to (string) off = true (1ms)
+112ms ║║Cancelling condition #17’s schedules…
+113ms ║║Condition #17 evaluated true (6ms)
+114ms ║║Cancelling condition #13’s schedules…
+115ms ║║Condition group #13 evaluated true (state changed) (9ms)
+118ms ║║Cancelling statement #14’s schedules…
+122ms ║║Skipped execution of physical command [Tom’s Light].off([]) because it would make no change to the device. (0ms)
+122ms ║║Executed [Tom’s Light].off (2ms)
+128ms ║║Executed virtual command [Tom’s Light].setVariable (3ms)
+131ms ║╚Execution stage complete. (43ms)
+132ms ╚Event processed successfully (132ms)
1/20/2018, 5:35:42 PM +195ms
+7ms ╔Received event [Home].time = 1516487743383 with a delay of -1189ms
+116ms ║RunTime Analysis CS > 26ms > PS > 52ms > PE > 34ms > CE
+121ms ║Runtime (40478 bytes) successfully initialized in 52ms (v0.2.102.20180116) (113ms)
+125ms ║╔Execution stage started
+228ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+244ms ║║Executed virtual command [Tom’s Light].setVariable (9ms)
+268ms ║║Executed physical command [Tom’s Light].setLevel([2]) (16ms)
+269ms ║║Executed [Tom’s Light].setLevel (22ms)
+275ms ║╚Execution stage complete. (153ms)
+279ms ╚Event processed successfully (278ms)
1/20/2018, 5:35:35 PM +252ms
+0ms ╔Received event [Home].time = 1516487736043 with a delay of -792ms
+99ms ║RunTime Analysis CS > 18ms > PS > 53ms > PE > 29ms > CE
+102ms ║Runtime (40478 bytes) successfully initialized in 53ms (v0.2.102.20180116) (101ms)
+103ms ║╔Execution stage started
+118ms ║║Cancelling condition #11’s schedules…
+119ms ║║Condition #11 evaluated true (2ms)
+120ms ║║Cancelling condition #5’s schedules…
+121ms ║║Condition group #5 evaluated true (state changed) (6ms)
+123ms ║║Cancelling statement #6’s schedules…
+129ms ║║Executed virtual command [Tom’s Light].wait (1ms)
+130ms ║║Requesting a wake up for Sat, Jan 20 2018 @ 5:35:43 PM EST (in 8.0s)
+136ms ║╚Execution stage complete. (34ms)
+138ms ║Setting up scheduled job for Sat, Jan 20 2018 @ 5:35:43 PM EST (in 7.994s)
+144ms ╚Event processed successfully (145ms)
1/20/2018, 5:35:27 PM +719ms
+3ms ╔Received event [Home].test = 1516487727715 with a delay of 4ms
+203ms ║RunTime Analysis CS > 21ms > PS > 152ms > PE > 26ms > CE
+214ms ║Runtime (40478 bytes) successfully initialized in 152ms (v0.2.102.20180116) (210ms)
+218ms ║╔Execution stage started
+227ms ║║Comparison (string) test is (string) test = true (2ms)
+228ms ║║Cancelling condition #12’s schedules…
+229ms ║║Condition #12 evaluated true (6ms)
+231ms ║║Cancelling condition #1’s schedules…
+231ms ║║Condition group #1 evaluated true (state changed) (8ms)
+237ms ║║Cancelling statement #2’s schedules…
+247ms ║║Skipped execution of physical command [Tom’s Light].on([]) because it would make no change to the device. (2ms)
+248ms ║║Executed [Tom’s Light].on (7ms)
+263ms ║║Executed virtual command [Tom’s Light].setVariable (9ms)
+283ms ║║Executed physical command [Tom’s Light].setLevel([1]) (12ms)
+284ms ║║Executed [Tom’s Light].setLevel (18ms)
+295ms ║║Comparison (integer) 1 is_less_than (integer) 60 = true (3ms)
+296ms ║║Condition #10 evaluated true (9ms)
+306ms ║║Comparison (enum) on stays_unchanged = true (3ms)
+320ms ║║Adding a timed trigger schedule for condition 11
+335ms ║║Cancelling condition #11’s schedules…
+336ms ║║Condition #11 evaluated false (38ms)
+337ms ║║Cancelling condition #5’s schedules…
+339ms ║║Condition group #5 evaluated false (state changed) (52ms)
+351ms ║║Condition #17 evaluated false (9ms)
+353ms ║║Condition group #13 evaluated false (state did not change) (11ms)
+375ms ║╚Execution stage complete. (160ms)
+406ms ║Setting up scheduled job for Sat, Jan 20 2018 @ 5:35:36 PM EST (in 7.924s)
+441ms ╚Event processed successfully (440ms)


#25

Played around with this and I think I got it working. I moved the while loop out of the first IF. Here is what seems to work.


#26

Yeah I think that was the right thing to do. It looked like each time the piston woke up to resume after the wait command it was reevaluating the IF, which was no longer true.

I’m curious to hear if the cancel feature works next! If not we’ll tweak it until it does.


#27

Yes, the cancel worked. When I turned the light off, it stayed off and the piston stopped.