Action not executed after wait


#1

1) Give a description of the problem
event after wait not firing

2) What is the expected behavior?
I would expect my light to be shutoff after the wait period

3) What is happening/not happening?
Nothing, sometimes. Other times light shuts off as expected. I don’t understand the logs when the piston wakes up after the wait. why isn’t the action after the wait executed?

**4) Post a Green Snapshot of the piston![image|45x37]
Edit: Piston link deleted by @Robin as it contains private info

5) Attach any logs (From ST IDE and by turning logging level to Full)
`(|+264ms|║║Cancelling condition #17’s schedules…|
|—|---|
|+265ms|║║Condition #17 evaluated true (5ms)|
|+267ms|║║Cancelling condition #10’s schedules…|
|+268ms|║║Condition group #10 evaluated true (state changed) (9ms)|
|+270ms|║║Cancelling statement #11’s schedules…|
|+275ms|║║Executed virtual command [Bathroom Light].wait (1ms)|
|+276ms|║║Requesting a wake up for Tue, Dec 19 2017 @ 10:56:15 PM PST (in 300.0s)|
|+281ms|║╚Execution stage complete. (61ms)|
)

12/19/2017, 10:56:14 PM +377ms
+0ms ╔Received event [Home].time = 1513752975732 with a delay of -1356ms
+224ms ║RunTime Analysis CS > 29ms > PS > 89ms > PE > 107ms > CE
+227ms ║Runtime (43747 bytes) successfully initialized in 89ms (v0.2.100.20171211) (226ms)
+228ms ║╔Execution stage started
+229ms ║╚Execution stage complete. (1ms)
+231ms ╚Event processed successfully (231ms)
`


#2

Please post a green snapshot of your piston using the green button at the bottom of the piston overview page.

You shared the URL and token to your piston which means we were all firing your piston every time we clicked the link. I deleted it and hid the revision for your privacy.


#3

From what I have learned, you probably need to set your IF statement to ‘asynchronous’.


#4

From your logs i would suggest the tasks are cancelling because your piston state has changed to true/false.
Therefore change Task Cancellation Policy (TCP) to never for your with.
This is pure guess work though.
You really should post the green snapshot if you want informed opinions.


#5

I’d like to change the TCP, but I can’t find any documentation telling me how to do it. All this stuff that changes behavior of the same code based on the “mode” you’re in is ridiculously confusing.

Oh, ok I found it.

I guess I had this piston setup with a trigger and not a condition and sometimes the event wasn’t executing for… z-wave reasons?

I basically want to turn a light on when there’s motion, then turn it off a few minutes after motion stops. The example piston I copied to do this months ago was using a trigger. I’ve now changed it to use a conditon-- motion is inactive rather than changes to.

This seems to work? Hard to say. I’ll have to let it run for a few more days. Has the default TCP changed or something? Again, this piston was based off of a webcore example from the wiki months and months ago. I don’t know why they were using a trigger and not a condition, but I just copied what they were doing.

Here’s the piston as it is now:


#6

Again it’s hard to advise without the piston screenshot.
Here is an example though.
Click on the word WITH when you are in edit mode for the piston.
Scroll down until you see the settings cog and click on it.
Now change TCP to never.
Save your way out and a red N will be seen next to the WITH statement.