I’m looking to create a piston that activates when a sensor is opened, counts the duration that it is open, and when the sensor closes it logs the information in a Google Spreadsheet.
I have the piston built including the ‘counting’ portion of it, but it doesn’t seem to be working properly. What happens right now is the @TimeOpened variable appears to be some sequential number between 1 and 10, never increasing beyond 10. If the door is held open for over 10 seconds, it resets back to 1.
I’m hoping that someone can show me another way to do this that would be much better/more efficient/reliable, or perhaps explain why my @TimeOpened integer keeps resetting back to 1.
-Edited for clarity
11/16/2019, 12:31:47 PM +250ms
+2ms ╔Received event [Front Door].contact = closed with a delay of 115ms
+8830ms ║RunTime Analysis CS > 121ms > PS > 8766ms > PE > 34ms > CE
+8831ms ║Piston waited at a semaphore for 8762ms
+8833ms ║Runtime (38290 bytes) successfully initialized in 8766ms (v0.3.110.20191009) (8830ms)
+8834ms ║╔Execution stage started
+8841ms ║║Comparison (enum) closed changes_to (string) open = false (0ms)
+8842ms ║║Cancelling condition #2's schedules...
+8843ms ║║Condition #2 evaluated false (5ms)
+8844ms ║║Cancelling condition #1's schedules...
+8845ms ║║Condition group #1 evaluated false (state changed) (6ms)
+8846ms ║╚Execution stage complete. (12ms)
+8847ms ╚Event processed successfully (8847ms)
11/16/2019, 12:31:45 PM +112ms
+0ms ╔Received event [Home].time = 1573936303459 with a delay of 1652ms
+737ms ║RunTime Analysis CS > 699ms > PS > 6ms > PE > 32ms > CE
+739ms ║Runtime (38209 bytes) successfully initialized in 6ms (v0.3.110.20191009) (738ms)
+740ms ║╔Execution stage started
+755ms ║║Calculating (integer) 0 + (integer) 1 >> (integer) 1
+757ms ║║Executed virtual command setVariable (1ms)
+766ms ║║Comparison (enum) open is (string) open = true (1ms)
+768ms ║║Condition #4 evaluated true (9ms)
+769ms ║║Condition group #3 evaluated true (state did not change) (10ms)
+771ms ║║Cancelling statement #5's schedules...
+774ms ║║Executed virtual command wait (1ms)
+775ms ║║Waiting for 1000ms
+1780ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+1784ms ║║Executed virtual command setVariable (1ms)
+1792ms ║║Comparison (enum) open is (string) open = true (2ms)
+1793ms ║║Condition #4 evaluated true (8ms)
+1794ms ║║Condition group #3 evaluated true (state did not change) (9ms)
+1796ms ║║Cancelling statement #5's schedules...
+1800ms ║║Executed virtual command wait (0ms)
+1800ms ║║Waiting for 1000ms
+2806ms ║║Calculating (integer) 2 + (integer) 1 >> (integer) 3
+2809ms ║║Executed virtual command setVariable (1ms)
+2816ms ║║Comparison (enum) closed is (string) open = false (1ms)
+2818ms ║║Cancelling condition #4's schedules...
+2819ms ║║Condition #4 evaluated false (8ms)
+2820ms ║║Cancelling condition #3's schedules...
+2821ms ║║Condition group #3 evaluated false (state changed) (11ms)
+2823ms ║║Cancelling statement #7's schedules...
+2913ms ║║Executed virtual command iftttMaker (86ms)
+2918ms ║╚Execution stage complete. (2178ms)
+2920ms ╚Event processed successfully (2920ms)
11/16/2019, 12:31:33 PM +93ms
+0ms ╔Received event [Home].time = 1573936291375 with a delay of 1717ms
+66ms ║RunTime Analysis CS > 37ms > PS > 5ms > PE > 25ms > CE
+69ms ║Runtime (38207 bytes) successfully initialized in 5ms (v0.3.110.20191009) (68ms)
+70ms ║╔Execution stage started
+87ms ║║Calculating (integer) 0 + (integer) 1 >> (integer) 1
+90ms ║║Executed virtual command setVariable (1ms)
+102ms ║║Comparison (enum) open is (string) open = true (2ms)
+104ms ║║Condition #4 evaluated true (12ms)
+105ms ║║Condition group #3 evaluated true (state did not change) (13ms)
+108ms ║║Cancelling statement #5's schedules...
+111ms ║║Executed virtual command wait (1ms)
+112ms ║║Waiting for 1000ms
+1119ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+1122ms ║║Executed virtual command setVariable (1ms)
+1131ms ║║Comparison (enum) open is (string) open = true (2ms)
+1133ms ║║Condition #4 evaluated true (9ms)
+1134ms ║║Condition group #3 evaluated true (state did not change) (10ms)
+1136ms ║║Cancelling statement #5's schedules...
+1140ms ║║Executed virtual command wait (0ms)
+1141ms ║║Waiting for 1000ms
+2146ms ║║Calculating (integer) 2 + (integer) 1 >> (integer) 3
+2151ms ║║Executed virtual command setVariable (3ms)
+2159ms ║║Comparison (enum) open is (string) open = true (2ms)
+2160ms ║║Condition #4 evaluated true (7ms)
+2161ms ║║Condition group #3 evaluated true (state did not change) (8ms)
+2165ms ║║Cancelling statement #5's schedules...
+2169ms ║║Executed virtual command wait (1ms)
+2170ms ║║Waiting for 1000ms
+3176ms ║║Calculating (integer) 3 + (integer) 1 >> (integer) 4
+3180ms ║║Executed virtual command setVariable (2ms)
+3188ms ║║Comparison (enum) open is (string) open = true (2ms)
+3189ms ║║Condition #4 evaluated true (7ms)
+3190ms ║║Condition group #3 evaluated true (state did not change) (9ms)
+3193ms ║║Cancelling statement #5's schedules...
+3196ms ║║Executed virtual command wait (1ms)
+3197ms ║║Waiting for 1000ms
+4203ms ║║Calculating (integer) 4 + (integer) 1 >> (integer) 5
+4206ms ║║Executed virtual command setVariable (1ms)
+4214ms ║║Comparison (enum) open is (string) open = true (1ms)
+4215ms ║║Condition #4 evaluated true (7ms)
+4216ms ║║Condition group #3 evaluated true (state did not change) (9ms)
+4218ms ║║Cancelling statement #5's schedules...
+4222ms ║║Executed virtual command wait (1ms)
+4223ms ║║Waiting for 1000ms
+5228ms ║║Calculating (integer) 5 + (integer) 1 >> (integer) 6
+5232ms ║║Executed virtual command setVariable (1ms)
+5241ms ║║Comparison (enum) open is (string) open = true (2ms)
+5243ms ║║Condition #4 evaluated true (9ms)
+5244ms ║║Condition group #3 evaluated true (state did not change) (10ms)
+5246ms ║║Cancelling statement #5's schedules...
+5249ms ║║Executed virtual command wait (0ms)
+5250ms ║║Waiting for 1000ms
+6257ms ║║Calculating (integer) 6 + (integer) 1 >> (integer) 7
+6260ms ║║Executed virtual command setVariable (0ms)
+6269ms ║║Comparison (enum) open is (string) open = true (2ms)
+6270ms ║║Condition #4 evaluated true (9ms)
+6271ms ║║Condition group #3 evaluated true (state did not change) (10ms)
+6274ms ║║Cancelling statement #5's schedules...
+6277ms ║║Executed virtual command wait (1ms)
+6278ms ║║Waiting for 1000ms
+7284ms ║║Calculating (integer) 7 + (integer) 1 >> (integer) 8
+7287ms ║║Executed virtual command setVariable (1ms)
+7296ms ║║Comparison (enum) open is (string) open = true (2ms)
+7297ms ║║Condition #4 evaluated true (8ms)
+7298ms ║║Condition group #3 evaluated true (state did not change) (10ms)
+7300ms ║║Cancelling statement #5's schedules...
+7304ms ║║Executed virtual command wait (0ms)
+7305ms ║║Waiting for 1000ms
+8312ms ║║Calculating (integer) 8 + (integer) 1 >> (integer) 9
+8316ms ║║Executed virtual command setVariable (1ms)
+8327ms ║║Comparison (enum) open is (string) open = true (2ms)
+8328ms ║║Condition #4 evaluated true (11ms)
+8329ms ║║Condition group #3 evaluated true (state did not change) (12ms)
+8332ms ║║Cancelling statement #5's schedules...
+8335ms ║║Executed virtual command wait (1ms)
+8336ms ║║Waiting for 1000ms
+9342ms ║║Calculating (integer) 9 + (integer) 1 >> (integer) 10
+9345ms ║║Executed virtual command setVariable (1ms)
+9355ms ║║Comparison (enum) open is (string) open = true (2ms)
+9356ms ║║Condition #4 evaluated true (9ms)
+9358ms ║║Condition group #3 evaluated true (state did not change) (10ms)
+9360ms ║║Cancelling statement #5's schedules...
+9364ms ║║Executed virtual command wait (0ms)
+9365ms ║║Requesting a wake up for Sat, Nov 16 2019 @ 12:31:43 PM PST (in 1.0s)
+9370ms ║╚Execution stage complete. (9301ms)
+9371ms ║Setting up scheduled job for Sat, Nov 16 2019 @ 12:31:43 PM PST (in 1s)
+9381ms ╚Event processed successfully (9381ms)
11/16/2019, 12:31:20 PM +931ms
+2ms ╔Received event [Front Door].contact = open with a delay of 62ms
+58ms ║RunTime Analysis CS > 20ms > PS > 9ms > PE > 29ms > CE
+60ms ║Runtime (38214 bytes) successfully initialized in 9ms (v0.3.110.20191009) (57ms)
+61ms ║╔Execution stage started
+68ms ║║Comparison (enum) open changes_to (string) open = true (1ms)
+70ms ║║Cancelling condition #2's schedules...
+70ms ║║Condition #2 evaluated true (5ms)
+71ms ║║Cancelling condition #1's schedules...
+72ms ║║Condition group #1 evaluated true (state changed) (7ms)
+78ms ║║Comparison (enum) open is (string) open = true (2ms)
+79ms ║║Cancelling condition #4's schedules...
+80ms ║║Condition #4 evaluated true (6ms)
+81ms ║║Cancelling condition #3's schedules...
+82ms ║║Condition group #3 evaluated true (state changed) (8ms)
+84ms ║║Cancelling statement #5's schedules...
+87ms ║║Executed virtual command wait (0ms)
+88ms ║║Waiting for 1000ms
+1095ms ║║Calculating (integer) 0 + (integer) 1 >> (integer) 1
+1097ms ║║Executed virtual command setVariable (1ms)
+1103ms ║║Comparison (enum) open is (string) open = true (1ms)
+1104ms ║║Condition #4 evaluated true (5ms)
+1105ms ║║Condition group #3 evaluated true (state did not change) (6ms)
+1107ms ║║Cancelling statement #5's schedules...
+1110ms ║║Executed virtual command wait (1ms)
+1111ms ║║Waiting for 1000ms
+2116ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+2119ms ║║Executed virtual command setVariable (1ms)
+2124ms ║║Comparison (enum) open is (string) open = true (1ms)
+2126ms ║║Condition #4 evaluated true (4ms)
+2127ms ║║Condition group #3 evaluated true (state did not change) (6ms)
+2129ms ║║Cancelling statement #5's schedules...
+2132ms ║║Executed virtual command wait (1ms)
+2133ms ║║Waiting for 1000ms
+3138ms ║║Calculating (integer) 2 + (integer) 1 >> (integer) 3
+3141ms ║║Executed virtual command setVariable (1ms)
+3147ms ║║Comparison (enum) open is (string) open = true (1ms)
+3148ms ║║Condition #4 evaluated true (5ms)
+3149ms ║║Condition group #3 evaluated true (state did not change) (7ms)
+3151ms ║║Cancelling statement #5's schedules...
+3155ms ║║Executed virtual command wait (0ms)
+3155ms ║║Waiting for 1000ms
+4161ms ║║Calculating (integer) 3 + (integer) 1 >> (integer) 4
+4164ms ║║Executed virtual command setVariable (1ms)
+4169ms ║║Comparison (enum) open is (string) open = true (1ms)
+4171ms ║║Condition #4 evaluated true (6ms)
+4172ms ║║Condition group #3 evaluated true (state did not change) (7ms)
+4174ms ║║Cancelling statement #5's schedules...
+4178ms ║║Executed virtual command wait (0ms)
+4179ms ║║Waiting for 1000ms
+5335ms ║║Calculating (integer) 4 + (integer) 1 >> (integer) 5
+5339ms ║║Executed virtual command setVariable (0ms)
+5345ms ║║Comparison (enum) open is (string) open = true (1ms)
+5347ms ║║Condition #4 evaluated true (6ms)
+5348ms ║║Condition group #3 evaluated true (state did not change) (7ms)
+5350ms ║║Cancelling statement #5's schedules...
+5353ms ║║Executed virtual command wait (0ms)
+5354ms ║║Waiting for 1000ms
+6359ms ║║Calculating (integer) 5 + (integer) 1 >> (integer) 6
+6362ms ║║Executed virtual command setVariable (1ms)
+6368ms ║║Comparison (enum) open is (string) open = true (1ms)
+6369ms ║║Condition #4 evaluated true (5ms)
+6370ms ║║Condition group #3 evaluated true (state did not change) (6ms)
+6372ms ║║Cancelling statement #5's schedules...
+6375ms ║║Executed virtual command wait (0ms)
+6376ms ║║Waiting for 1000ms
+7381ms ║║Calculating (integer) 6 + (integer) 1 >> (integer) 7
+7384ms ║║Executed virtual command setVariable (1ms)
+7390ms ║║Comparison (enum) open is (string) open = true (2ms)
+7391ms ║║Condition #4 evaluated true (5ms)
+7392ms ║║Condition group #3 evaluated true (state did not change) (6ms)
+7395ms ║║Cancelling statement #5's schedules...
+7398ms ║║Executed virtual command wait (0ms)
+7399ms ║║Waiting for 1000ms
+8404ms ║║Calculating (integer) 7 + (integer) 1 >> (integer) 8
+8406ms ║║Executed virtual command setVariable (1ms)
+8412ms ║║Comparison (enum) open is (string) open = true (2ms)
+8413ms ║║Condition #4 evaluated true (5ms)
+8414ms ║║Condition group #3 evaluated true (state did not change) (6ms)
+8417ms ║║Cancelling statement #5's schedules...
+8420ms ║║Executed virtual command wait (0ms)
+8420ms ║║Waiting for 1000ms
+9426ms ║║Calculating (integer) 8 + (integer) 1 >> (integer) 9
+9428ms ║║Executed virtual command setVariable (1ms)
+9434ms ║║Comparison (enum) open is (string) open = true (2ms)
+9435ms ║║Condition #4 evaluated true (5ms)
+9436ms ║║Condition group #3 evaluated true (state did not change) (6ms)
+9438ms ║║Cancelling statement #5's schedules...
+9442ms ║║Executed virtual command wait (0ms)
+9443ms ║║Requesting a wake up for Sat, Nov 16 2019 @ 12:31:31 PM PST (in 1.0s)
+9447ms ║╚Execution stage complete. (9386ms)
+9448ms ║Setting up scheduled job for Sat, Nov 16 2019 @ 12:31:31 PM PST (in 1s)
+9456ms ╚Event processed successfully (9456ms)