Light not turning off after wait


#1

1) Give a description of the problem
Lights not turning off after wait, should be a very simple program. I even check the device in the ide and event history doesn’t show getting the command. See it turn on, then nothing.
2) What is the expected behavior?
If motion, turn on light, after 2 minutes, turn off.

3) What is happening/not happening?
Light turns on when expected, doesn’t turn off

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
2017-11-03 8:30:44.395 AM CDT 2 hours ago DEVICE switch off Front Porch switch is off **Manually Turned Off** 2017-11-03 8:19:39.666 AM CDT 2 hours ago DEVICE level 100 Front Porch level is 100 2017-11-03 7:19:39.420 AM CDT 3 hours ago DEVICE level 7 Front Porch level is 7 2017-11-03 7:19:39.057 AM CDT 3 hours ago DEVICE switch on Front Porch switch is on 2017-11-03 7:19:38.114 AM CDT 3 hours ago APP_COMMAND on Motion on Porch sent on command to Front Porch

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Just change the code to use AND.
If time is between sunset and sunrise
AND
motion is active
Then DO


#3

Will give that a try. Sadly, can’t test it until after sunset :frowning:


#4

Click on the word with when in edit mode.
Now click on the settings cog.
Now under Task Cancellation Policy (TCP) select never.
That will solve the problem.


#5

Thanks, give this a try as well.


#6

I would even venture to split it into

IF motion and time
then light on
elseif: motion inactive and light on
wait 2 minutes, light off

that way if you are still in the area, it’ll still keep the light on.

of course if it’s not necessary then…


#7

Perfectly valid statement but just for information so does the example I posted.
If motion is detected within the 2 minute countdown window the timer stops.
When it goes inactive it then starts again.
So if there is constant motion for 30 minutes the light will never turn off.
Just thought I would clarify.


#8

ah yes


#9

Did this work for you? I have a piston where my scheduled tasks to turn off lights don’t work after wait statements as well. I have task cancellation policy set to never.


#10

If you could post your piston then people can give you advice on what could be happening.


#11

Thanks, I think I got it right after posting. I set the piston to disable command optimization and it seems reliable so far.