Help with basic motion Piston


#1

1) Give a description of the problem
I pulled the code from a working piston that I am using on the kitchen lights. I applied it to the pantry lights and now the pantry lights come on for a millisecond and then they turn off.

2) What is the expected behaviour?
I expect the lights to be on when motion is sensed and off after 1 minute of no motion sensed.

3) What is happening/not happening?
The lights come on when motion is sensed for approximately a millisecond and then they turn off. If i hit the switch a few times it will eventually trigger the lights to come on and then turn off after 1 minute of inactive.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
Logs are empty.


#2

go into the options of the with command that has the 1 minute delay and set the second option down to never cancel


#3

Change “Motion IS” to “Motion Changes to” and line 29 task cancel to NEVER.


#4

Im not sure what you mean by “set the second option down to never cancel” I cant find options for the 1 minute delay or anything involving cancelling. Where do I find this?


#5

line 29, click on it and it will open up, click the cog at the bottom, this will open additional options, the second one in the list, change that to never cancel.

also make the other change mentioned above, I never noticed that you had it set to “motion is”, it needs to be “motion changes to”


#6

I had it as “Changes to” before and it did the same thing. I have now added the cancel never part. What does that do?


#7

it prevents the code from being cancelled by a change in the trigger that caused it to run in the first place.

so while you are waiting the motion sensor will no longer be changes to, that change event will have passed, when the piston realises this it cancels the execution, if you set it to never cancel then it will execute the rest of the code in the current block (if statement) regardless


#8

Here’s how I would do it…

Also, if it’s for a pantry, you can probably get rid of the 1 minute wait time. Motion sensors already have a 1 minute “cool down”, so you’re essentially waiting 2 minutes to turn the light off. I would probably just turn the light off if the motion sensor motion changes to inactive.

Good luck!


#9

@Equis’ piston gets my vote!


#10

Agreed.