Can not get door closing from stopping the timer

triggers

#1

1) Give a description of the problem
Open door triggers light as desired, but when door closes, timer turns off.

2) What is the expected behaviour?
Front door opens, when at night, and if switch is not allready on.
Turn on Circle light, for 5 min, turn off.

3) What is happening/not happening?
timer stops, I tried changing trigger changes to open to other comminations, then having a true/false variable for if the doot was open, then I changed the TCP. All failed to allow the timer to run. I have numerous other pistons with wait states with not issues. But I am apparenly not smart enough to have the door closing not stop a timer!
**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
### Logs

5/1/2019, 5:54:10 AM +421ms
+135ms ╔Stopping piston...
+358ms ╚Piston successfully stopped (224ms)
4/30/2019, 11:07:40 PM +300ms
+1ms ╔Received event [Home].time = 1556680061228 with a delay of -928ms
+139ms ║RunTime Analysis CS > 28ms > PS > 71ms > PE > 39ms > CE
+141ms ║Runtime (39742 bytes) successfully initialized in 71ms (v0.3.10a.20190223) (139ms)
+143ms ║╔Execution stage started
+167ms ║║Skipped execution of physical command [Light_circle].off([]) because it would make no change to the device. (4ms)
+168ms ║║Executed [Light_circle].off (7ms)
+173ms ║║Executed virtual command [Light_circle].setState (1ms)
+191ms ║╚Execution stage complete. (49ms)
+193ms ║Setting up scheduled job for Wed, May 1 2019 @ 6:44:00 AM EDT (in 27379.508s)
+204ms ╚Event processed successfully (204ms)
4/30/2019, 11:05:36 PM +809ms
+1ms ╔Received event [Light_circle].switch = off with a delay of 91ms
+99ms ║RunTime Analysis CS > 14ms > PS > 48ms > PE > 38ms > CE
+102ms ║Runtime (39740 bytes) successfully initialized in 48ms (v0.3.10a.20190223) (100ms)
+103ms ║╔Execution stage started
+121ms ║║Comparison (enum) closed is (string) open = false (2ms)
+124ms ║║Condition #11 evaluated false (12ms)
+125ms ║║Condition group #10 evaluated false (state did not change) (15ms)
+127ms ║║Condition group #9 evaluated false (state did not change) (17ms)
+130ms ║╚Execution stage complete. (27ms)
+133ms ║Setting up scheduled job for Tue, Apr 30 2019 @ 11:07:41 PM EDT (in 124.287s), with 1 more job pending
+172ms ╚Event processed successfully (171ms)
4/30/2019, 11:04:55 PM +12ms
+1ms ╔Received event [Front_Door].contact = closed with a delay of 635ms
+93ms ║RunTime Analysis CS > 14ms > PS > 45ms > PE > 35ms > CE
+96ms ║Runtime (39740 bytes) successfully initialized in 45ms (v0.3.10a.20190223) (94ms)
+97ms ║╔Execution stage started
+111ms ║║Comparison (enum) closed is (string) open = false (2ms)
+113ms ║║Cancelling condition #11's schedules...
+114ms ║║Condition #11 evaluated false (9ms)
+116ms ║║Condition group #10 evaluated false (state did not change) (11ms)
+117ms ║║Condition group #9 evaluated false (state did not change) (14ms)
+121ms ║╚Execution stage complete. (24ms)
+123ms ║Setting up scheduled job for Tue, Apr 30 2019 @ 11:07:41 PM EDT (in 166.094s), with 1 more job pending
+134ms ╚Event processed successfully (134ms

#2

I always like the else condition in this situation

Then
With
White bulb 2
Do
Turn on
Set piston state
End do
End with

Else
With
White bulb 2
Do
Wait 3 minutes
Turn off
Set piston state
End do
End with


#3

jkp, Thanks this seems to work. You have save me hours of frustration!

Not sure I understand why. Is it because that when the door closes and triggers again it can not turn the light on because it already in a on state and therfore executes the Else statement?


#4

Try contact changes to open


#5

I did, and then is not closed and everthing between. It appear that the Else statment for wait is working


#6

The issue here is you trigger on the door being open but then when the wait returns to finish, the door is closed so the state has changed and the if becomes false thereby not allowing the finishing of he execution. Since this piston serves a single purpose, I suggest taking he action out of the if statement. Then the trigger will cause the piston to execute and the actions will always occur since they no longer require the logic. Personally, I would do something like this:

If contact 2 changes to open           <--trigger
  then
    If White bulb 2 is on                     <-- condition
         or
       Time is not between 20 minutes past sunset and nextsunrise. <--condition
    then
       exit 'switch is on or it is daytime'
    endif
else
    exit 'door closing'
endif
with white bulb 2
    turn on
    wait 5 minutes
    turn off
end with

#7

guxdude, I feel like I am so close but can quite get the piston to work. I believe I have one of the exit statements in the wrong place, and have tried countless combinations without success. Can you point me in the correct direction. They way it is now, the piston fires with the correct conditions, after dark, switch off, then door opens. The light goes on, and timer starts, but as soon as the door closes, the timer stops.


#8

It looks like you have implemented properly. I suspect the door closing execution is cancelling the wait. Go into the settings on the with statement and change the task cancellation policy to never. Hopefully that will fix it.


#9

I tired but could not get to work. The attached is not very elegant, but it works! I think I will leave well enough alone. I used some of what you suggested with setting a variable to execute against. Thanks again.