Okay I just saw this thread-is this the only answer?
Sorry to clog the boards if so. I’ll experiment tomorrow.
How to make a piston fire only if switch is not already on
I like the simplicity here:
IF Sensor's motion changes to active
Then Turn on SimSwitch (or Porch lights directly)
END IF
IF Sensor's motion stays inactive for 5 minutes (or whatever)
Then Turn off SimSwitch (or Porch lights directly)
END IF
With this method, as long as someone is still in front of the sensor, the lights will stay on…
(don’t set the time too small, or you may find yourself waving your arms to bring them back. I usually start with 3-5 min and go from there)
Don’t feel bad though… It is all part of the calibration process.
(IE: your timeout in the bathroom will not be the same as the one in the garage)
That being said, @bangali’s piston is a great way to incorporate an override switch.
The way I have it set up now is I have security spy sensing camera motion-that sends a webhoook to ifttt that turns on a virtual switch (“AA porch lights virtual switch” in my example). I have a piston that immediately turns the virtual switch off so it’s ready to “turn on” with the next motion.
So it’s not actually a motion sensor.
So how would that be incorporated into your example? I like the theory-makes perfect sense.
Thank You!!
Ahhh, I see…
You have a device that sees motion, and registers motion, and runs a piston at motion…
… but you have no device to see inactivity… or register inactivity… or run a piston when inactive…
What method are you planning to use to determine when the porch is vacant?
The lack of the sim switch being turned on?
It’s basically acting like a momentary switch as I have a piston that turns it to off a moment after it is turned on by the camera motion.
If you do not have a device you can use for this, you may be forced to count each event, and compare the current time to a previous time, and then decide what to do with the porch light. (this thread may inspire you, or it may encourage you to go a different route entirely)
Pro Tip:
It is definitely possible to code this here in webCoRE, but my recommendation would be to simply install a real motion sensor on your porch, LOL
You can try it… but the condition
“did not change” never sets a schedule for me…
(maybe it is unfinished code like the trigger
“stays unchanged”)
To clarify a bit:
- The
trigger
“stays unchanged” is always true, regardless of how often it changes… - The
condition
“did not change” is not even checked from what I can see…
"Stays away from" and "Stays any of" triggers unexpected behavior
Preventing flapping of a devcie
New Here, does this night light look ok
This works-everytime the switch changes to “on” it resets the timer to the start of the 3 minutes.
Thanks for the idea. It’s even better than what I had in mind as it requires no interaction to achieve the required result.
Now I just need to figure out how to make the lights open to 80% before midnight and 100% after midnight.
Would you be willing to post full logs showing the initial turn on, at least one extension, and the final turn off please?
I’d love to see what is happening behind the scenes.
For the record, I tried using your “switch did not change” using a few variations, and they all failed for me to set the schedule. (Note: I am not looking at the Dashboard timer, I am looking at the log and the final results)
When I change your second IF to the following, it works every time.
As long as “Switch1” changes to off at least once every 2m 59s, then “Switch2” will not turn off.
(IE: Switch1 changing to on cancels the timer… Switch1 changing to off begins the timer)
Note:
To make testing easier, you can reduce that 3min to 1min during testing.
6/12/2020, 4:56:49 PM +184ms
+0ms ╔Received event [Charles St].time = 1591995410366 with a delay of -1183ms
+90ms ║RunTime Analysis CS > 23ms > PS > 37ms > PE > 30ms > CE
+92ms ║Runtime (37366 bytes) successfully initialized in 37ms (v0.3.110.20191009) (91ms)
+93ms ║╔Execution stage started
+109ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].off([]) because it would make no change to the device. (2ms)
+110ms ║║Executed [Porch Lights Back Porch Lights].off (4ms)
+113ms ║╚Execution stage complete. (19ms)
+114ms ╚Event processed successfully (113ms)
6/12/2020, 4:53:50 PM +144ms
+2ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 68ms
+109ms ║RunTime Analysis CS > 21ms > PS > 49ms > PE > 39ms > CE
+112ms ║Runtime (37373 bytes) successfully initialized in 49ms (v0.3.110.20191009) (109ms)
+112ms ║╔Execution stage started
+120ms ║║Comparison (enum) off is (string) on = false (1ms)
+121ms ║║Cancelling condition #2's schedules...
+122ms ║║Condition #2 evaluated false (6ms)
+123ms ║║Cancelling condition #1's schedules...
+124ms ║║Condition group #1 evaluated false (state changed) (7ms)
+211ms ║║Comparison (enum) off did_not_change = true (83ms)
+212ms ║║Condition #6 evaluated true (86ms)
+213ms ║║Condition group #5 evaluated true (state did not change) (87ms)
+215ms ║║Cancelling statement #7's schedules...
+220ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+221ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:56:50 PM EDT (in 180.0s)
+225ms ║╚Execution stage complete. (113ms)
+226ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:56:50 PM EDT (in 179.996s)
+238ms ╚Event processed successfully (238ms)
6/12/2020, 4:53:49 PM +830ms
+2ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 59ms
+97ms ║RunTime Analysis CS > 18ms > PS > 40ms > PE > 38ms > CE
+99ms ║Runtime (37374 bytes) successfully initialized in 40ms (v0.3.110.20191009) (97ms)
+100ms ║╔Execution stage started
+107ms ║║Comparison (enum) on is (string) on = true (1ms)
+108ms ║║Cancelling condition #2's schedules...
+109ms ║║Condition #2 evaluated true (6ms)
+110ms ║║Cancelling condition #1's schedules...
+110ms ║║Condition group #1 evaluated true (state changed) (7ms)
+112ms ║║Cancelling statement #3's schedules...
+123ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (5ms)
+123ms ║║Executed [Porch Lights Back Porch Lights].setLevel (7ms)
+144ms ║║Comparison (enum) on did_not_change = true (16ms)
+145ms ║║Condition #6 evaluated true (19ms)
+146ms ║║Condition group #5 evaluated true (state did not change) (20ms)
+148ms ║║Cancelling statement #7's schedules...
+151ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+152ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:56:49 PM EDT (in 180.0s)
+156ms ║╚Execution stage complete. (57ms)
+158ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:56:49 PM EDT (in 179.996s)
+169ms ╚Event processed successfully (169ms)
6/12/2020, 4:53:16 PM +613ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 45ms
+9846ms ║RunTime Analysis CS > 16ms > PS > 9794ms > PE > 36ms > CE
+9847ms ║Piston waited at a semaphore for 9764ms
+9849ms ║Runtime (37447 bytes) successfully initialized in 9794ms (v0.3.110.20191009) (9847ms)
+9850ms ║╔Execution stage started
+9857ms ║║Comparison (enum) off is (string) on = false (1ms)
+9858ms ║║Cancelling condition #2's schedules...
+9859ms ║║Condition #2 evaluated false (5ms)
+9860ms ║║Cancelling condition #1's schedules...
+9861ms ║║Condition group #1 evaluated false (state changed) (8ms)
+9883ms ║║Comparison (enum) off did_not_change = true (18ms)
+9884ms ║║Condition #6 evaluated true (21ms)
+9885ms ║║Condition group #5 evaluated true (state did not change) (22ms)
+9887ms ║║Cancelling statement #7's schedules...
+9891ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+9892ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:56:26 PM EDT (in 180.0s)
+9895ms ║╚Execution stage complete. (46ms)
+9897ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:56:26 PM EDT (in 179.996s)
+9907ms ╚Event processed successfully (9907ms)
6/12/2020, 4:53:16 PM +321ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 59ms
+106ms ║RunTime Analysis CS > 17ms > PS > 45ms > PE > 43ms > CE
+108ms ║Runtime (37375 bytes) successfully initialized in 45ms (v0.3.110.20191009) (106ms)
+109ms ║╔Execution stage started
+116ms ║║Comparison (enum) on is (string) on = true (1ms)
+118ms ║║Cancelling condition #2's schedules...
+119ms ║║Condition #2 evaluated true (6ms)
+120ms ║║Cancelling condition #1's schedules...
+121ms ║║Condition group #1 evaluated true (state changed) (7ms)
+123ms ║║Cancelling statement #3's schedules...
+177ms ║║Executed physical command [Porch Lights Back Porch Lights].setLevel([88]) (50ms)
+178ms ║║Executed [Porch Lights Back Porch Lights].setLevel (51ms)
+299ms ║║Comparison (enum) on did_not_change = true (116ms)
+300ms ║║Condition #6 evaluated true (119ms)
+301ms ║║Condition group #5 evaluated true (state did not change) (121ms)
+304ms ║║Cancelling statement #7's schedules...
+307ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+308ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:56:16 PM EDT (in 180.0s)
+312ms ║╚Execution stage complete. (203ms)
+314ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:56:16 PM EDT (in 179.996s)
+325ms ╚Event processed successfully (325ms)
6/12/2020, 4:51:56 PM +55ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 62ms
+105ms ║RunTime Analysis CS > 17ms > PS > 43ms > PE > 45ms > CE
+107ms ║Runtime (37373 bytes) successfully initialized in 43ms (v0.3.110.20191009) (105ms)
+108ms ║╔Execution stage started
+116ms ║║Comparison (enum) off is (string) on = false (2ms)
+117ms ║║Cancelling condition #2's schedules...
+118ms ║║Condition #2 evaluated false (6ms)
+119ms ║║Cancelling condition #1's schedules...
+120ms ║║Condition group #1 evaluated false (state changed) (8ms)
+144ms ║║Comparison (enum) off did_not_change = true (19ms)
+145ms ║║Condition #6 evaluated true (22ms)
+146ms ║║Condition group #5 evaluated true (state did not change) (24ms)
+149ms ║║Cancelling statement #7's schedules...
+153ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+154ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:54:56 PM EDT (in 180.0s)
+159ms ║╚Execution stage complete. (50ms)
+160ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:54:56 PM EDT (in 179.996s)
+171ms ╚Event processed successfully (171ms)
6/12/2020, 4:51:55 PM +733ms
+2ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 65ms
+104ms ║RunTime Analysis CS > 18ms > PS > 47ms > PE > 38ms > CE
+106ms ║Runtime (37375 bytes) successfully initialized in 47ms (v0.3.110.20191009) (104ms)
+107ms ║╔Execution stage started
+114ms ║║Comparison (enum) on is (string) on = true (1ms)
+116ms ║║Cancelling condition #2's schedules...
+116ms ║║Condition #2 evaluated true (5ms)
+117ms ║║Cancelling condition #1's schedules...
+118ms ║║Condition group #1 evaluated true (state changed) (8ms)
+120ms ║║Cancelling statement #3's schedules...
+130ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (4ms)
+130ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+154ms ║║Comparison (enum) on did_not_change = true (19ms)
+156ms ║║Condition #6 evaluated true (22ms)
+157ms ║║Condition group #5 evaluated true (state did not change) (23ms)
+159ms ║║Cancelling statement #7's schedules...
+162ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+163ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:54:55 PM EDT (in 180.0s)
+167ms ║╚Execution stage complete. (60ms)
+168ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:54:55 PM EDT (in 179.996s)
+178ms ╚Event processed successfully (178ms)
6/12/2020, 4:51:12 PM +145ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 69ms
+9873ms ║RunTime Analysis CS > 20ms > PS > 9814ms > PE > 40ms > CE
+9874ms ║Piston waited at a semaphore for 9764ms
+9876ms ║Runtime (37447 bytes) successfully initialized in 9814ms (v0.3.110.20191009) (9874ms)
+9877ms ║╔Execution stage started
+9885ms ║║Comparison (enum) off is (string) on = false (2ms)
+9886ms ║║Cancelling condition #2's schedules...
+9887ms ║║Condition #2 evaluated false (6ms)
+9888ms ║║Cancelling condition #1's schedules...
+9889ms ║║Condition group #1 evaluated false (state changed) (8ms)
+9960ms ║║Comparison (enum) off did_not_change = true (67ms)
+9961ms ║║Condition #6 evaluated true (70ms)
+9962ms ║║Condition group #5 evaluated true (state did not change) (71ms)
+9964ms ║║Cancelling statement #7's schedules...
+9969ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+9970ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:54:22 PM EDT (in 180.0s)
+9974ms ║╚Execution stage complete. (97ms)
+9975ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:54:22 PM EDT (in 179.996s)
+9986ms ╚Event processed successfully (9986ms)
6/12/2020, 4:51:11 PM +796ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 62ms
+118ms ║RunTime Analysis CS > 22ms > PS > 54ms > PE > 42ms > CE
+121ms ║Runtime (37375 bytes) successfully initialized in 54ms (v0.3.110.20191009) (118ms)
+121ms ║╔Execution stage started
+129ms ║║Comparison (enum) on is (string) on = true (1ms)
+130ms ║║Cancelling condition #2's schedules...
+131ms ║║Condition #2 evaluated true (6ms)
+132ms ║║Cancelling condition #1's schedules...
+132ms ║║Condition group #1 evaluated true (state changed) (7ms)
+134ms ║║Cancelling statement #3's schedules...
+144ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (5ms)
+145ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+235ms ║║Comparison (enum) on did_not_change = true (86ms)
+236ms ║║Condition #6 evaluated true (89ms)
+237ms ║║Condition group #5 evaluated true (state did not change) (90ms)
+239ms ║║Cancelling statement #7's schedules...
+242ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+243ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:54:12 PM EDT (in 180.0s)
+247ms ║╚Execution stage complete. (126ms)
+248ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:54:12 PM EDT (in 179.996s)
+359ms ╚Event processed successfully (359ms)
6/12/2020, 4:49:14 PM +797ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 50ms
+82ms ║RunTime Analysis CS > 16ms > PS > 28ms > PE > 38ms > CE
+84ms ║Runtime (37372 bytes) successfully initialized in 28ms (v0.3.110.20191009) (83ms)
+85ms ║╔Execution stage started
+92ms ║║Comparison (enum) off is (string) on = false (1ms)
+93ms ║║Cancelling condition #2's schedules...
+94ms ║║Condition #2 evaluated false (5ms)
+95ms ║║Cancelling condition #1's schedules...
+96ms ║║Condition group #1 evaluated false (state changed) (8ms)
+117ms ║║Comparison (enum) off did_not_change = true (16ms)
+118ms ║║Condition #6 evaluated true (19ms)
+119ms ║║Condition group #5 evaluated true (state did not change) (20ms)
+120ms ║║Cancelling statement #7's schedules...
+124ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+125ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:52:14 PM EDT (in 180.0s)
+129ms ║╚Execution stage complete. (44ms)
+130ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:52:14 PM EDT (in 179.996s)
+141ms ╚Event processed successfully (141ms)
6/12/2020, 4:49:14 PM +505ms
+2ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 64ms
+107ms ║RunTime Analysis CS > 18ms > PS > 49ms > PE > 40ms > CE
+109ms ║Runtime (37375 bytes) successfully initialized in 49ms (v0.3.110.20191009) (107ms)
+110ms ║╔Execution stage started
+118ms ║║Comparison (enum) on is (string) on = true (1ms)
+119ms ║║Cancelling condition #2's schedules...
+120ms ║║Condition #2 evaluated true (6ms)
+121ms ║║Cancelling condition #1's schedules...
+121ms ║║Condition group #1 evaluated true (state changed) (7ms)
+123ms ║║Cancelling statement #3's schedules...
+133ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (5ms)
+134ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+156ms ║║Comparison (enum) on did_not_change = true (18ms)
+157ms ║║Condition #6 evaluated true (21ms)
+158ms ║║Condition group #5 evaluated true (state did not change) (22ms)
+160ms ║║Cancelling statement #7's schedules...
+163ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+164ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:52:14 PM EDT (in 180.0s)
+168ms ║╚Execution stage complete. (58ms)
+170ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:52:14 PM EDT (in 179.996s)
+244ms ╚Event processed successfully (244ms)
6/12/2020, 4:48:32 PM +158ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 46ms
+89ms ║RunTime Analysis CS > 20ms > PS > 30ms > PE > 39ms > CE
+92ms ║Runtime (37372 bytes) successfully initialized in 30ms (v0.3.110.20191009) (90ms)
+92ms ║╔Execution stage started
+100ms ║║Comparison (enum) off is (string) on = false (2ms)
+101ms ║║Cancelling condition #2's schedules...
+102ms ║║Condition #2 evaluated false (6ms)
+103ms ║║Cancelling condition #1's schedules...
+104ms ║║Condition group #1 evaluated false (state changed) (7ms)
+125ms ║║Comparison (enum) off did_not_change = true (16ms)
+126ms ║║Condition #6 evaluated true (20ms)
+127ms ║║Condition group #5 evaluated true (state did not change) (20ms)
+129ms ║║Cancelling statement #7's schedules...
+132ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+134ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:51:32 PM EDT (in 180.0s)
+137ms ║╚Execution stage complete. (45ms)
+139ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:51:32 PM EDT (in 179.996s)
+155ms ╚Event processed successfully (155ms)
6/12/2020, 4:48:31 PM +881ms
+2ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 64ms
+108ms ║RunTime Analysis CS > 19ms > PS > 50ms > PE > 38ms > CE
+110ms ║Runtime (37375 bytes) successfully initialized in 50ms (v0.3.110.20191009) (108ms)
+111ms ║╔Execution stage started
+118ms ║║Comparison (enum) on is (string) on = true (1ms)
+119ms ║║Cancelling condition #2's schedules...
+120ms ║║Condition #2 evaluated true (5ms)
+121ms ║║Cancelling condition #1's schedules...
+122ms ║║Condition group #1 evaluated true (state changed) (8ms)
+124ms ║║Cancelling statement #3's schedules...
+132ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (3ms)
+132ms ║║Executed [Porch Lights Back Porch Lights].setLevel (4ms)
+205ms ║║Comparison (enum) on did_not_change = true (68ms)
+206ms ║║Condition #6 evaluated true (71ms)
+207ms ║║Condition group #5 evaluated true (state did not change) (72ms)
+209ms ║║Cancelling statement #7's schedules...
+212ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+213ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:51:32 PM EDT (in 180.0s)
+217ms ║╚Execution stage complete. (106ms)
+218ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:51:32 PM EDT (in 179.996s)
+229ms ╚Event processed successfully (229ms)
6/12/2020, 4:48:12 PM +8ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 52ms
+86ms ║RunTime Analysis CS > 15ms > PS > 34ms > PE > 37ms > CE
+88ms ║Runtime (37372 bytes) successfully initialized in 34ms (v0.3.110.20191009) (86ms)
+89ms ║╔Execution stage started
+97ms ║║Comparison (enum) off is (string) on = false (1ms)
+99ms ║║Cancelling condition #2's schedules...
+99ms ║║Condition #2 evaluated false (6ms)
+100ms ║║Cancelling condition #1's schedules...
+101ms ║║Condition group #1 evaluated false (state changed) (8ms)
+171ms ║║Comparison (enum) off did_not_change = true (65ms)
+172ms ║║Condition #6 evaluated true (68ms)
+173ms ║║Condition group #5 evaluated true (state did not change) (70ms)
+175ms ║║Cancelling statement #7's schedules...
+179ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+181ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:51:12 PM EDT (in 180.0s)
+185ms ║╚Execution stage complete. (95ms)
+186ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:51:12 PM EDT (in 179.996s)
+198ms ╚Event processed successfully (198ms)
6/12/2020, 4:48:11 PM +728ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 45ms
+79ms ║RunTime Analysis CS > 14ms > PS > 31ms > PE > 34ms > CE
+81ms ║Runtime (37374 bytes) successfully initialized in 31ms (v0.3.110.20191009) (79ms)
+82ms ║╔Execution stage started
+90ms ║║Comparison (enum) on is (string) on = true (1ms)
+91ms ║║Cancelling condition #2's schedules...
+92ms ║║Condition #2 evaluated true (6ms)
+93ms ║║Cancelling condition #1's schedules...
+94ms ║║Condition group #1 evaluated true (state changed) (8ms)
+96ms ║║Cancelling statement #3's schedules...
+105ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (5ms)
+106ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+128ms ║║Comparison (enum) on did_not_change = true (17ms)
+129ms ║║Condition #6 evaluated true (20ms)
+130ms ║║Condition group #5 evaluated true (state did not change) (22ms)
+132ms ║║Cancelling statement #7's schedules...
+135ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+137ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:51:11 PM EDT (in 180.0s)
+142ms ║╚Execution stage complete. (60ms)
+143ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:51:11 PM EDT (in 179.994s)
+154ms ╚Event processed successfully (154ms)
6/12/2020, 4:45:18 PM +917ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 58ms
+104ms ║RunTime Analysis CS > 18ms > PS > 43ms > PE > 42ms > CE
+106ms ║Runtime (37373 bytes) successfully initialized in 43ms (v0.3.110.20191009) (104ms)
+107ms ║╔Execution stage started
+115ms ║║Comparison (enum) off is (string) on = false (2ms)
+116ms ║║Cancelling condition #2's schedules...
+117ms ║║Condition #2 evaluated false (6ms)
+118ms ║║Cancelling condition #1's schedules...
+119ms ║║Condition group #1 evaluated false (state changed) (8ms)
+142ms ║║Comparison (enum) off did_not_change = true (17ms)
+143ms ║║Condition #6 evaluated true (21ms)
+144ms ║║Condition group #5 evaluated true (state did not change) (23ms)
+146ms ║║Cancelling statement #7's schedules...
+151ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+152ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:48:19 PM EDT (in 180.0s)
+156ms ║╚Execution stage complete. (49ms)
+158ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:48:19 PM EDT (in 179.996s)
+176ms ╚Event processed successfully (176ms)
6/12/2020, 4:45:18 PM +586ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 53ms
+97ms ║RunTime Analysis CS > 18ms > PS > 42ms > PE > 37ms > CE
+99ms ║Runtime (37374 bytes) successfully initialized in 42ms (v0.3.110.20191009) (97ms)
+100ms ║╔Execution stage started
+107ms ║║Comparison (enum) on is (string) on = true (1ms)
+109ms ║║Cancelling condition #2's schedules...
+110ms ║║Condition #2 evaluated true (5ms)
+111ms ║║Cancelling condition #1's schedules...
+111ms ║║Condition group #1 evaluated true (state changed) (7ms)
+113ms ║║Cancelling statement #3's schedules...
+122ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (4ms)
+123ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+148ms ║║Comparison (enum) on did_not_change = true (21ms)
+149ms ║║Condition #6 evaluated true (24ms)
+150ms ║║Condition group #5 evaluated true (state did not change) (25ms)
+152ms ║║Cancelling statement #7's schedules...
+155ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+156ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:48:18 PM EDT (in 180.0s)
+160ms ║╚Execution stage complete. (60ms)
+162ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:48:18 PM EDT (in 179.996s)
+171ms ╚Event processed successfully (171ms)
6/12/2020, 4:43:05 PM +132ms
+2ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 69ms
+206ms ║RunTime Analysis CS > 111ms > PS > 49ms > PE > 46ms > CE
+208ms ║Runtime (37374 bytes) successfully initialized in 49ms (v0.3.110.20191009) (206ms)
+209ms ║╔Execution stage started
+217ms ║║Comparison (enum) off is (string) on = false (1ms)
+218ms ║║Cancelling condition #2's schedules...
+219ms ║║Condition #2 evaluated false (6ms)
+220ms ║║Cancelling condition #1's schedules...
+221ms ║║Condition group #1 evaluated false (state changed) (8ms)
+243ms ║║Comparison (enum) off did_not_change = true (18ms)
+245ms ║║Condition #6 evaluated true (21ms)
+246ms ║║Condition group #5 evaluated true (state did not change) (22ms)
+248ms ║║Cancelling statement #7's schedules...
+253ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+254ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:46:05 PM EDT (in 180.0s)
+258ms ║╚Execution stage complete. (49ms)
+260ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:46:05 PM EDT (in 179.996s)
+270ms ╚Event processed successfully (270ms)
6/12/2020, 4:43:04 PM +571ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 43ms
+314ms ║RunTime Analysis CS > 123ms > PS > 154ms > PE > 37ms > CE
+316ms ║Runtime (37378 bytes) successfully initialized in 154ms (v0.3.110.20191009) (314ms)
+317ms ║╔Execution stage started
+325ms ║║Comparison (enum) on is (string) on = true (1ms)
+327ms ║║Cancelling condition #2's schedules...
+328ms ║║Condition #2 evaluated true (5ms)
+329ms ║║Cancelling condition #1's schedules...
+329ms ║║Condition group #1 evaluated true (state changed) (8ms)
+331ms ║║Cancelling statement #3's schedules...
+339ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (4ms)
+340ms ║║Executed [Porch Lights Back Porch Lights].setLevel (5ms)
+389ms ║║Comparison (enum) on did_not_change = true (44ms)
+390ms ║║Condition #6 evaluated true (47ms)
+391ms ║║Condition group #5 evaluated true (state did not change) (48ms)
+393ms ║║Cancelling statement #7's schedules...
+396ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+397ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:46:04 PM EDT (in 180.0s)
+401ms ║╚Execution stage complete. (84ms)
+403ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:46:04 PM EDT (in 179.996s)
+413ms ╚Event processed successfully (413ms)
6/12/2020, 4:42:49 PM +735ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 73ms
+114ms ║RunTime Analysis CS > 25ms > PS > 52ms > PE > 38ms > CE
+117ms ║Runtime (37373 bytes) successfully initialized in 52ms (v0.3.110.20191009) (114ms)
+117ms ║╔Execution stage started
+125ms ║║Comparison (enum) off is (string) on = false (1ms)
+126ms ║║Cancelling condition #2's schedules...
+127ms ║║Condition #2 evaluated false (6ms)
+128ms ║║Cancelling condition #1's schedules...
+129ms ║║Condition group #1 evaluated false (state changed) (7ms)
+150ms ║║Comparison (enum) off did_not_change = true (17ms)
+151ms ║║Condition #6 evaluated true (20ms)
+152ms ║║Condition group #5 evaluated true (state did not change) (21ms)
+154ms ║║Cancelling statement #7's schedules...
+159ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+160ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:45:49 PM EDT (in 180.0s)
+164ms ║╚Execution stage complete. (47ms)
+165ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:45:49 PM EDT (in 179.996s)
+177ms ╚Event processed successfully (177ms)
6/12/2020, 4:42:49 PM +383ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 58ms
+98ms ║RunTime Analysis CS > 18ms > PS > 41ms > PE > 39ms > CE
+101ms ║Runtime (37374 bytes) successfully initialized in 41ms (v0.3.110.20191009) (99ms)
+102ms ║╔Execution stage started
+109ms ║║Comparison (enum) on is (string) on = true (1ms)
+110ms ║║Cancelling condition #2's schedules...
+111ms ║║Condition #2 evaluated true (6ms)
+112ms ║║Cancelling condition #1's schedules...
+113ms ║║Condition group #1 evaluated true (state changed) (8ms)
+115ms ║║Cancelling statement #3's schedules...
+124ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (5ms)
+125ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+225ms ║║Comparison (enum) on did_not_change = true (95ms)
+226ms ║║Condition #6 evaluated true (98ms)
+227ms ║║Condition group #5 evaluated true (state did not change) (99ms)
+229ms ║║Cancelling statement #7's schedules...
+232ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+233ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:45:49 PM EDT (in 180.0s)
+237ms ║╚Execution stage complete. (136ms)
+238ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:45:49 PM EDT (in 179.996s)
+254ms ╚Event processed successfully (253ms)
6/12/2020, 4:42:28 PM +559ms
+0ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 46ms
+9888ms ║RunTime Analysis CS > 16ms > PS > 9839ms > PE > 34ms > CE
+9889ms ║Piston waited at a semaphore for 9807ms
+9891ms ║Runtime (37447 bytes) successfully initialized in 9839ms (v0.3.110.20191009) (9890ms)
+9892ms ║╔Execution stage started
+9899ms ║║Comparison (enum) off is (string) on = false (2ms)
+9900ms ║║Cancelling condition #2's schedules...
+9901ms ║║Condition #2 evaluated false (6ms)
+9902ms ║║Cancelling condition #1's schedules...
+9902ms ║║Condition group #1 evaluated false (state changed) (7ms)
+9924ms ║║Comparison (enum) off did_not_change = true (18ms)
+9925ms ║║Condition #6 evaluated true (20ms)
+9926ms ║║Condition group #5 evaluated true (state did not change) (22ms)
+9928ms ║║Cancelling statement #7's schedules...
+9931ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+9933ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:45:38 PM EDT (in 180.0s)
+9936ms ║╚Execution stage complete. (44ms)
+9937ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:45:38 PM EDT (in 179.996s)
+9946ms ╚Event processed successfully (9946ms)
6/12/2020, 4:42:28 PM +298ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 54ms
+108ms ║RunTime Analysis CS > 22ms > PS > 40ms > PE > 46ms > CE
+110ms ║Runtime (37375 bytes) successfully initialized in 40ms (v0.3.110.20191009) (108ms)
+111ms ║╔Execution stage started
+118ms ║║Comparison (enum) on is (string) on = true (1ms)
+120ms ║║Cancelling condition #2's schedules...
+121ms ║║Condition #2 evaluated true (5ms)
+122ms ║║Cancelling condition #1's schedules...
+123ms ║║Condition group #1 evaluated true (state changed) (7ms)
+125ms ║║Cancelling statement #3's schedules...
+135ms ║║Skipped execution of physical command [Porch Lights Back Porch Lights].setLevel([88]) because it would make no change to the device. (5ms)
+135ms ║║Executed [Porch Lights Back Porch Lights].setLevel (6ms)
+238ms ║║Comparison (enum) on did_not_change = true (98ms)
+239ms ║║Condition #6 evaluated true (101ms)
+240ms ║║Condition group #5 evaluated true (state did not change) (102ms)
+242ms ║║Cancelling statement #7's schedules...
+245ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+246ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:45:28 PM EDT (in 180.0s)
+250ms ║╚Execution stage complete. (139ms)
+252ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:45:28 PM EDT (in 179.996s)
+264ms ╚Event processed successfully (265ms)
6/12/2020, 4:41:51 PM +787ms
+1ms ╔Received event [AA porch lights virtual switch].switch = off with a delay of 266ms
+103ms ║RunTime Analysis CS > 22ms > PS > 42ms > PE > 40ms > CE
+105ms ║Runtime (37374 bytes) successfully initialized in 42ms (v0.3.110.20191009) (103ms)
+106ms ║╔Execution stage started
+114ms ║║Comparison (enum) off is (string) on = false (1ms)
+115ms ║║Cancelling condition #2's schedules...
+116ms ║║Condition #2 evaluated false (6ms)
+117ms ║║Cancelling condition #1's schedules...
+118ms ║║Condition group #1 evaluated false (state changed) (8ms)
+139ms ║║Comparison (enum) off did_not_change = true (17ms)
+140ms ║║Condition #6 evaluated true (20ms)
+141ms ║║Condition group #5 evaluated true (state did not change) (21ms)
+143ms ║║Cancelling statement #7's schedules...
+147ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (0ms)
+148ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:44:51 PM EDT (in 180.0s)
+152ms ║╚Execution stage complete. (46ms)
+154ms ║Setting up scheduled job for Fri, Jun 12 2020 @ 4:44:51 PM EDT (in 179.996s)
+164ms ╚Event processed successfully (164ms)
6/12/2020, 4:41:51 PM +173ms
+1ms ╔Received event [AA porch lights virtual switch].switch = on with a delay of 60ms
+209ms ║RunTime Analysis CS > 18ms > PS > 42ms > PE > 148ms > CE
+211ms ║Runtime (37376 bytes) successfully initialized in 42ms (v0.3.110.20191009) (209ms)
+212ms ║╔Execution stage started
+219ms ║║Comparison (enum) on is (string) on = true (1ms)
+221ms ║║Cancelling condition #2's schedules...
+222ms ║║Condition #2 evaluated true (5ms)
+223ms ║║Cancelling condition #1's schedules...
+223ms ║║Condition group #1 evaluated true (state changed) (8ms)
+226ms ║║Cancelling statement #3's schedules...
+281ms ║║Executed physical command [Porch Lights Back Porch Lights].setLevel([88]) (51ms)
+282ms ║║Executed [Porch Lights Back Porch Lights].setLevel (53ms)
+305ms ║║Comparison (enum) on did_not_change = true (17ms)
+306ms ║║Condition #6 evaluated true (21ms)
+307ms ║║Condition group #5 evaluated true (state did not change) (22ms)
+310ms ║║Cancelling statement #7's schedules...
+314ms ║║Executed virtual command [Porch Lights Back Porch Lights].wait (1ms)
+315ms ║║Requesting a wake up for Fri, Jun 12 2020 @ 4:44:51 PM EDT (in 180.0s)
Thanks for sharing your log!
Notice how at each and every event you see this:
Condition #6 evaluated true
This confirms that “does not change” is broke, and does not function
at all.
In other words, your last trigger
is an illusion…
The following piston should do the exact same thing…
As long as Switch1 keeps on toggling, then Switch2 will not turn off
If you have an HE system, I’m looking for some testers for the fixes I have for “stays *”
The HE repo is updated. If. you use Hubitat package manager, you need to do a repair on webcore as I have not updated the HPM files to force the update on everyone (but it is available to everyone)
So I have been looking at all this more. I don’t think webCoRE is broken (but there are improvements in labeling I think)
‘did not change’ is a condition. (and it looks backward in time, IT DOES NOT SET A FUTURE TIMER)
-
when the piston runs (because of some other event), it looks backwards in time to see if the variable changed or not within the specified duration (assuming there are enough events (in HE for example, one could set the db that there is very limited history))
-
there is no condition ‘does not change’. (this form of writing suggests a future check, which conditions don’t do)
-
there is a trigger ‘stays unchanged’ which is forward looking in time (IE IT MAY SET A FUTURE TIMER)
-
the first time it is run, it returns FALSE, which means it either initialized the timer requested for a future check OR the timer is already active (but has not occurred)
-
if a change happens, it will cancel the timer (so it will never fire).
-
if no change happens, the timer fires, and the TRUE side of the if xxx ‘stays unchanged’ is executed
-
note the piston is not executed from the top, it picks up at the TRUE side of the if statement
-
THIS MEANS IT IS IMPORTANT TO NOT NEST ‘stays’ COMMANDS IN CODE PATHS THAT MAY NOT EXECUTE on some events (of the device in question), as the TIMER CANCEL or RESETS MAY NOT OCCUR.
- ie every trigger of the device attribute in question needs to run over this if statement so the timers are managed correctly.
-
-
So ‘stays unchanged’ internal method comparison in the code does return TRUE, but internally this is a ‘flag’ that FALSE SHOULD BE RETURNED AND THE TIMER SET IF IT IS NOT ALREADY SET
Here is a simple trigger test of ‘stays unchanged’:
The first time it is run: (NOTE IT RETURNS FALSE - the stays unchanged has not happened yet)
And what it looks like if the timer expires (ie there is no change):
- also note the bottom time stamp - 15 seconds into the future from the first run
- ie there were two executions - whatever triggered the first, and then the timer later
Now the bug in webcore I fixed in HE is the trace information is not set correctly for the IDE display (it actually executes correctly, but you see strange things in the IDE). (above have the fix in HE)
- this leads to a lot of confusion (including my own initially)
The other bug I changed in HE, is how the IDE displays other ‘stays’ commands
For example:
let’s look at simple ‘stays’
ie. if contactDevices’s contact ‘stays’ open for 2 minutes
This really means:
-
if contactDevices’ contact is open now, and stays open for 2 minutes execute the TRUE side of the if
- again the first run, returns FALSE (and if the contact is open, it sets the timer)
- if the timer completes, the piston picks up on the TRUE side of the if statement based on the timer
- if the contact changes, if that event has the piston run over this if statement again, that runner will cancel the timer (and give you a false assuming the contact is NOT OPEN)
So I changed a couple of things
- the IDE trace fix above is in place
- I changed the wording to be accurate;
- to set the timer, the attribute must be the requested value
Do something only if location mode has been set to Away for 3 minutes
All of a sudden piston if/then statement not working correctly
Door contact open then close notifications. help!
Controlling Cielo Breez Plus with Window/Door Sensors
Entrance hallway lighting - optimize piston(s)
Light on with contact sensor, off quickly unless motion
'stays open' evaluating true when it's not true
Piston continues to execute even arguments not met
Close garage door if there's no motion
Issues with "are now and stays inactive" on latest patch
"Stays away from" and "Stays any of" triggers unexpected behavior
Belatedly picking up on this. I see things differently. The problem, in the ST version at least, is that a change does not cancel the timer.
If you consider something like vswitch4's switch stays on for 15 seconds
, the comparison that is actually used is the equivalent of is on
. So first time round if vswitch4
is on
that will return true
and a 15 second timer is started.
Now supposing five seconds later the piston runs again and vswitch4
is now off
. The comparison now returns false
and that is what ‘cancels’ the timer (I’d imagine the timer actually still occurs but there is nothing to do when it does, so lets call it cancelled).
Without making that comparison there is no way the piston can know that vswitch4
is no longer on
. The piston could be running because it reported on
again, or the Test button was pressed, or for any number of other reasons that don’t require the timer to be cancelled because vswitch4
is still on
…
When it comes to vswitch4's switch stays unchanged for 15 seconds
the comparison used is actually return true
. So first time around the timer starts, but if vswitch4
does change in the next 15 seconds there is no way the comparison can return false
to cancel the timer. No test is actually being made to see if vswitch4
is still the same or not.
The bottom line is that it doesn’t work.
I read this through twice and I still don’t think I get it all completely. But the bottom line is that we should not use stays unchanged right?
My understanding of the way ‘stays’ works and my reading of the code suggests that ‘stays unchanged’ doesn’t detect when there are changes and so doesn’t work.
My testing of it a few minutes ago suggests that indeed it doesn’t work.
Interesting.
Here is another try at it (on HE). This will cancel, but the logic is the device:attr needs to change to start it off.