Light turning on with door open help


#1

1) Give a description of the problem
Light turns on with door opening, but I want the timer to re-start (from 0) every time the door is opened. Instead, it always turns off when the initial timer expires (the timer never resets). If I change the execution policy away from “never cancel”, then the piston will turn on/off the light correctly if the door is only opened once, but if I open it again, the light never turns off, so I am not sure what to change.

Thank you in advance for any help!

2) What is the expected behaviour?
If it is after sunset (dark), and the outside light is off, turn on patio light when door opens; if the door closes & is re-opened, re-start the timer.

3) What is happening/not happening?
Light comes on when door is opened, but always shuts off after the initial timer expires, even if the door is re-opened… I had to set the “never cancel” option because otherwise when re-opening the door after the light is turned on the first time, the piston will cancel based on the light now being on.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)
11/14/2020, 9:56:19 PM +13ms
+8ms ╔Received event [9011Hub].time = 1605416179179 with a delay of -166ms, canQueue: true, calledMyself: false
+36ms ║RunTime initialize > 35 LockT > 1ms > rtDT > 2ms > pistonT > 0ms (first state access 32 9 26)
+38ms ║Runtime (6294 bytes) successfully initialized in 2ms (v0.3.110.20201015_HE)
+40ms ║Synchronizing scheduled event, waiting for 126ms
+172ms ║╔Execution stage started
+222ms ║║Executed physical command [Patio lights].off() (23ms)
+223ms ║║Executed [Patio lights].off (25ms)
+228ms ║╚Execution stage complete. (60ms)
+231ms ╚Event processed successfully (229ms)
11/14/2020, 9:56:17 PM +912ms
+2ms ╔Received event [Slider].contact = closed with a delay of 50ms, canQueue: true, calledMyself: false
+24ms ║RunTime initialize > 23 LockT > 1ms > rtDT > 1ms > pistonT > 1ms (first state access 21 4 19)
+25ms ║Runtime (6275 bytes) successfully initialized in 1ms (v0.3.110.20201015_HE)
+26ms ║╔Execution stage started
+31ms ║║Comparison (enum) closed changes_to (string) open = false (0ms)
+33ms ║║Cancelling condition #2’s schedules…
+34ms ║║Condition #2 evaluated false (5ms)
+35ms ║║Cancelling condition #1’s schedules…
+36ms ║║Condition group #1 evaluated false (state changed) (8ms)
+40ms ║╚Execution stage complete. (14ms)
+81ms ║Setting up scheduled job for Sat, Nov 14 2020 @ 9:56:19 PM MST (in 1s)
+82ms ╚Event processed successfully (81ms)
11/14/2020, 9:56:13 PM +357ms
+2ms ╔Received event [Slider].contact = open with a delay of 44ms, canQueue: true, calledMyself: false
+21ms ║RunTime initialize > 20 LockT > 1ms > rtDT > 1ms > pistonT > 0ms (first state access 18 3 17)
+23ms ║Runtime (6274 bytes) successfully initialized in 1ms (v0.3.110.20201015_HE)
+24ms ║╔Execution stage started
+29ms ║║Comparison (enum) open changes_to (string) open = true (0ms)
+30ms ║║Cancelling condition #2’s schedules…
+31ms ║║Condition #2 evaluated true (5ms)
+43ms ║║Comparison (time) 78973000 is_between (time) 62640000 … (time) 25080000 = true (8ms)
+44ms ║║Time restriction check passed
+46ms ║║Condition #3 evaluated true (14ms)
+47ms ║║Cancelling condition #1’s schedules…
+48ms ║║Condition group #1 evaluated true (state changed) (22ms)
+53ms ║║Comparison (enum) on is (string) off = false (0ms)
+54ms ║║Cancelling condition #5’s schedules…
+55ms ║║Condition #5 evaluated false (6ms)
+56ms ║║Cancelling condition #4’s schedules…
+57ms ║║Condition group #4 evaluated false (state changed) (8ms)
+61ms ║╚Execution stage complete. (38ms)
+89ms ║Setting up scheduled job for Sat, Nov 14 2020 @ 9:56:19 PM MST (in 6s)
+91ms ╚Event processed successfully (90ms)
11/14/2020, 9:56:00 PM +568ms
+3ms ╔Received event [Slider].contact = closed with a delay of 37ms, canQueue: true, calledMyself: false
+20ms ║RunTime initialize > 19 LockT > 1ms > rtDT > 1ms > pistonT > 0ms (first state access 17 4 15)
+22ms ║Runtime (6265 bytes) successfully initialized in 1ms (v0.3.110.20201015_HE)
+23ms ║╔Execution stage started
+28ms ║║Comparison (enum) closed changes_to (string) open = false (0ms)
+30ms ║║Cancelling condition #2’s schedules…
+31ms ║║Condition #2 evaluated false (5ms)
+32ms ║║Cancelling condition #1’s schedules…
+33ms ║║Condition group #1 evaluated false (state changed) (8ms)
+37ms ║╚Execution stage complete. (15ms)
+68ms ║Setting up scheduled job for Sat, Nov 14 2020 @ 9:56:19 PM MST (in 19s)
+70ms ╚Event processed successfully (69ms)
11/14/2020, 9:55:49 PM +26ms
+3ms ╔Received event [Slider].contact = open with a delay of 32ms, canQueue: true, calledMyself: false
+35ms ║RunTime initialize > 34 LockT > 1ms > rtDT > 21ms > pistonT > 20ms (first state access 12 4 30)
+38ms ║Runtime (6206 bytes) successfully initialized in 21ms (v0.3.110.20201015_HE)
+39ms ║╔Execution stage started
+46ms ║║Comparison (enum) open changes_to (string) open = true (1ms)
+48ms ║║Cancelling condition #2’s schedules…
+49ms ║║Condition #2 evaluated true (7ms)
+61ms ║║Comparison (time) 78949000 is_between (time) 62640000 … (time) 25080000 = true (7ms)
+62ms ║║Time restriction check passed
+64ms ║║Condition #3 evaluated true (13ms)
+65ms ║║Cancelling condition #1’s schedules…
+66ms ║║Condition group #1 evaluated true (state changed) (23ms)
+70ms ║║Comparison (enum) off is (string) off = true (1ms)
+72ms ║║Condition #5 evaluated true (4ms)
+73ms ║║Condition group #4 evaluated true (state did not change) (6ms)
+74ms ║║Cancelling statement #6’s schedules…
+147ms ║║Executed physical command [Patio lights].on() (69ms)
+148ms ║║Executed [Patio lights].on (70ms)
+151ms ║║Executed virtual command [Patio lights].wait (1ms)
+153ms ║║Requesting a wake up for Sat, Nov 14 2020 @ 9:56:19 PM MST (in 30s)
+163ms ║╚Execution stage complete. (124ms)
+186ms ║Setting up scheduled job for Sat, Nov 14 2020 @ 9:56:19 PM MST (in 30s)
+187ms ╚Event processed successfully (186ms)


#2

This is not tested but try the following.
I use the NOT option when timing spans midnight. Spanning midnight can sometimes cause problems.

IF Device 47 changes to open
and
Time is NOT between 1 hour past sunrise and 15 minutes to sunset
  Then
    with Switch 50
      Do
        Cancel all previous tasks
        Turn on
        Wait 30 seconds
        Turn off
      END with
END IF

#3

Thanks, @Pantheon - I had not thought of the cancel previous tasks. This does not account for the other requirement to check if the light was already on though (if it was on because people were out on the patio already, I don’t want the door opening to start the timer to turn the light off). In my original piston, it checks to make sure the light is off before turning it on with a timer. Is it valid to populate a variable when this piston does turn the light on in order to check that, too, and if this piston did turn it on to cancel all tasks then?


#4

Sorry, I did not get that from the original post. How are you determining if people are on the porch? Motion sensor?

You certainly can set a boolean variable to see if the lights were turned on by the piston, and/or you could use the programmatically option. I don’t use the programmatically option, and some have reported inconsistent results. But it may be worth a try in your situation.


#5

Thank you, @Pantheon - here is what I ended up with, in case it helps anyone else. Not sure it’s the *best way, but it seems to work fine…


#6

Webcore%20Green%20Check%20II