Troubleshooting Piston Design for Outdoor Lights Turning On when Garage Opens Between Sunset/Sunrise


#1

1) Give a description of the problem
The piston works in that it turns on the lights when the garage is open between sunset/sunrise. The piston however is failing to turn off the lights 2 minutes after the garage door is closed.

2) What is the expected behaviour?
The piston turns on Outdoor Lights when either Garage Door opens between sunset/sunrise. And turn off the lights 2 minutes after the Garage Doors are closed.

3) What is happening/not happening?
The lights are not being turned off 2 minutes after the garage door closes.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
12/10/2020, 5:09:34 AM +970ms
+1ms ╔Received event [Two Car Garage Door].door = open with a delay of 71ms
+76ms ║RunTime Analysis CS > 19ms > PS > 6ms > PE > 52ms > CE
+78ms ║Runtime (41734 bytes) successfully initialized in 6ms (v0.3.110.20191009) (76ms)
+79ms ║╔Execution stage started
+93ms ║║Comparison (enum) closed is (string) open = false (1ms)
+95ms ║║Comparison (enum) open is (string) open = true (1ms)
+97ms ║║Cancelling condition #4’s schedules…
+98ms ║║Condition #4 evaluated true (14ms)
+112ms ║║Comparison (enum) off is (string) off = true (1ms)
+113ms ║║Cancelling condition #6’s schedules…
+114ms ║║Condition #6 evaluated true (15ms)
+155ms ║║Comparison (time) 18575086 is_between (time) 1607638920000 … (time) 1607605740000 = true (9ms)
+157ms ║║Time restriction check passed
+158ms ║║Cancelling condition #22’s schedules…
+159ms ║║Condition #22 evaluated true (43ms)
+160ms ║║Cancelling statement #22’s schedules…
+169ms ║║Requesting time schedule wake up at Thu, Dec 10 2020 @ 7:09:00 AM CST
+171ms ║║Cancelling condition #7’s schedules…
+172ms ║║Condition group #7 evaluated true (state changed) (57ms)
+173ms ║║Cancelling condition #5’s schedules…
+174ms ║║Condition group #5 evaluated true (state changed) (75ms)
+175ms ║║Cancelling condition #1’s schedules…
+176ms ║║Condition group #1 evaluated true (state changed) (93ms)
+178ms ║║Cancelling statement #9’s schedules…
+692ms ║║Executed physical command [Front Door Light Switch].on() (511ms)
+693ms ║║Executed [Front Door Light Switch].on (513ms)
+711ms ║║Executed physical command [Garage (Outdoor) Light Switch].on() (16ms)
+712ms ║║Executed [Garage (Outdoor) Light Switch].on (18ms)
+743ms ║║Executed virtual command [Front Door Light Switch, Garage (Outdoor) Light Switch].sendPushNotification (27ms)
+748ms ║║Executed virtual command [Front Door Light Switch, Garage (Outdoor) Light Switch].setVariable (3ms)
+759ms ║║Condition #14 evaluated false (8ms)
+760ms ║║Condition group #13 evaluated false (state did not change) (9ms)
+762ms ║╚Execution stage complete. (683ms)
+764ms ║Setting up scheduled job for Thu, Dec 10 2020 @ 7:09:00 AM CST (in 7164.267s)
+771ms ╚Event processed successfully (771ms)

12/10/2020, 5:10:53 AM +863ms
+2ms ╔Received event [Two Car Garage Door].door = closed with a delay of 86ms
+91ms ║RunTime Analysis CS > 24ms > PS > 8ms > PE > 59ms > CE
+94ms ║Runtime (41730 bytes) successfully initialized in 8ms (v0.3.110.20191009) (91ms)
+95ms ║╔Execution stage started
+110ms ║║Comparison (enum) closed is (string) open = false (1ms)
+112ms ║║Comparison (enum) closed is (string) open = false (1ms)
+114ms ║║Cancelling condition #4's schedules...
+115ms ║║Condition #4 evaluated false (15ms)
+116ms ║║Cancelling condition #1's schedules...
+117ms ║║Condition group #1 evaluated false (state changed) (18ms)
+128ms ║║Condition #14 evaluated false (8ms)
+129ms ║║Condition group #13 evaluated false (state did not change) (9ms)
+131ms ║╚Execution stage complete. (36ms)
+132ms ║Setting up scheduled job for Thu, Dec 10 2020 @ 7:09:00 AM CST (in 7086.005s)
+201ms ╚Event processed successfully (201ms)

#2

1 - I believe you need to setup TCP (task cancellation policy to NEVER)
2 - You don’t have a trigger you have conditions - i know that works too but I’d prefer triggers if i were you


#3

It is extremely rare that both doors will close at the same instant

I would change line 41 to:
IF All of Sensor 4 & Sensor 5's door STAYS closed for 2 mins
(you can then delete the WAIT on line 50)


#4

As @wcmore has pointed out, you have a problem with line 41.

Contact Sensor 4 door changes to closed is only true if the piston is currently running because it is handling an event for the Contact Sensor 4 device and the door attribute, the value in the event is closed, and the value the last time the trigger was evaluated was not closed so it has changed.

The same applies for Contact Sensor 5 door changes to closed.

They cannot be true at the same time so line 41 is never true.


#5

Thank you for your help, greatly appreciated!

I made the change and will test tomorrow morning! :slight_smile:

Attached is the updated code if anyone would like to copy it:


#6

Bringing an old topic back into the lime light.

I have recently run into an issue with this piston, if the garage door is OPEN before sunset, and closed AFTER Sunset, the piston turns off the lights.

Any thoughts on what is driving the execution?


#7

Yes, on line 28 you have explicitly set the subscription method to ‘always subscribe’ and so the piston will be fired at sunset and sunrise.

That would mean if one or both of the contacts is/are open at sunset, and also one or both of the lights are off, then the Activated variable would be set to true.

That would mean when the door closes after sunset the lights would be turned off.

Or something like that. I think it is definitely the piston running at sunset doing it.


#8

Thank you for the feedback. What would the fix be? To set it to “Never”?


#9

It could be set to the default ‘auto’ but ‘never’ makes it explicit.