Light on for 30 seconds after door opens and closes


#1

1) Give a description of the problem
I’m a newbie to webcore and I’m trying to figure out the subtle nuances of the system. What I’m trying to do with this piston is turn on a light for 30 seconds after a door opens (and potentially closes)

2) What is the expected behavior?
Door opens, light comes on and stays on for 30 seconds regardless of whether door closes or not

3) What is happening/not happening?
Open Sensor is read, light comes on and timer starts, but once door closes, timer stops thus light never goes off (unless door is left open > 30 seconds)

**4) Post a Green Snapshot of the piston

5) Attach logs after turning logging level to Full

8/22/2019, 2:55:19 PM +450ms
+1ms ╔Received event [TH Front Door Switch].contact = closed with a delay of 242ms
+64ms ║RunTime Analysis CS > 18ms > PS > 31ms > PE > 15ms > CE
+66ms ║Runtime (38599 bytes) successfully initialized in 31ms (v0.3.10e.20190628) (64ms)
+67ms ║╔Execution stage started
+75ms ║║Comparison (enum) closed is (string) open = false (1ms)
+77ms ║║Cancelling condition #3’s schedules…
+78ms ║║Condition #3 evaluated false (5ms)
+79ms ║║Cancelling condition #2’s schedules…
+80ms ║║Condition group #2 evaluated false (state changed) (8ms)
+80ms ║║Cancelling condition #1’s schedules…
+81ms ║║Condition group #1 evaluated false (state changed) (10ms)
+83ms ║║Cancelling statement #14’s schedules…
+96ms ║║Executed virtual command sendPushNotification (9ms)
+99ms ║╚Execution stage complete. (32ms)
+101ms ║Setting up scheduled job for Thu, Aug 22 2019 @ 8:00:00 PM CDT (in 18280.45s)
+112ms ╚Event processed successfully (112ms)
8/22/2019, 2:55:16 PM +602ms
+2ms ╔Received event [TH Front Door Switch].contact = open with a delay of 107ms
+87ms ║RunTime Analysis CS > 20ms > PS > 44ms > PE > 22ms > CE
+89ms ║Runtime (38605 bytes) successfully initialized in 44ms (v0.3.10e.20190628) (86ms)
+90ms ║╔Execution stage started
+98ms ║║Comparison (enum) open is (string) open = true (2ms)
+99ms ║║Cancelling condition #3’s schedules…
+100ms ║║Condition #3 evaluated true (6ms)
+110ms ║║Comparison (time) 53716703 is_between (time) 60000 … (time) 72000000 = true (6ms)
+111ms ║║Time restriction check passed
+112ms ║║Condition #18 evaluated true (11ms)
+113ms ║║Cancelling statement #18’s schedules…
+118ms ║║Requesting time schedule wake up at Thu, Aug 22 2019 @ 8:00:00 PM CDT
+120ms ║║Cancelling condition #2’s schedules…
+121ms ║║Condition group #2 evaluated true (state changed) (27ms)
+122ms ║║Cancelling condition #1’s schedules…
+123ms ║║Condition group #1 evaluated true (state changed) (29ms)
+125ms ║║Cancelling statement #7’s schedules…
+144ms ║║Executed virtual command [TH Outlet Lights].sendPushNotification (13ms)
+162ms ║║Executed physical command [TH Outlet Lights].on() (17ms)
+163ms ║║Executed [TH Outlet Lights].on (18ms)
+166ms ║║Executed virtual command [TH Outlet Lights].wait (1ms)
+167ms ║║Requesting a wake up for Thu, Aug 22 2019 @ 2:55:46 PM CDT (in 30.0s)
+171ms ║╚Execution stage complete. (82ms)
+173ms ║Setting up scheduled job for Thu, Aug 22 2019 @ 2:55:46 PM CDT (in 29.995s), with 1 more job pending
+184ms ╚Event processed successfully (184ms)

I’m sure there is a simple solution to this but I’m just not seeing it. Any assistance is appreciated !!!


#2

I would start with something like this:

IF 
   Contact Sensor CHANGES TO open
   and
   Time is between X and Y
   Then
      With Outlet  (TCP set to Never)
      Send PUSH
      Turn on
      Wait 30 seconds
      Turn off
END IF

If you really want to use an ELSE, then I would program a bit differently.


#3

You need to use NEVER CANCEL TASK when using WAIT.
LIne 24…
Click in the WITH
You’ll see a wheel icon - Click
scrool down and choose NEVER CANCEL TASK
once done, you’ll see an orange cicrle next to WITH.

And change line 19 to CHANGES TO OPEN


#4

*blows smoke from his fingertips* :sunglasses:


#5

You beat me to it with seconds LOL


#6

works like a charm now. Thanks everyone for their input and education!