Lights with motion on, but won't turn off when motion stops


#1

1) Give a description of the problem
I have a piston that worked pretty good in Core, but I can’t get it right in WebCore. It was a latching piston.

2) What is the expected behavior?
Its supposed to turn some lights on with motion and turn them off when motion stops.

3) What is happening/not happening?
They turn on fine (but with some serious lag), but they never turn off.

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

Here is the Core piston that worked.

Here is the WebCore Version that does not shut off.

I’m clearly just not familiar with the right pattern in WebCore to match a latching piston. Thanks a bunch!!


#2

In your situation, I’d recommend going to just 1 if, then else statement

If
Motion Sensor changes to active
then
only when bulb 1 and bulb 2 are off
with
bulb 1 and bulb 2
do
set levels, etc
else
with
bulb 1 and 2
wait 45 minutes
turn off


#3

Thanks. I’ve made that change and will see how it goes when I get home.


#4

To help you understand why it wasn’t shutting off.

You have everything inside the if statement that says if motion changes to active. Then a blank if statement and inside that then turn the lights on.

Below that if but still inside the original if motion changes to active and the blank if you have if motion changes to inactive.

So the first issue is nested triggers. 2 triggers can ever be true at the same time. So you couldn’t have something like if motion sensor 1 AND motion sensor 2 changes to active because those two events can never happen at the same exact time. This applies to nested if statements. They also conflict with each other. You are checking if it changes to active and then changes to inactive inside the first if. Once it changes to inactive then the first if statement is now false. So it will cancel all the statements inside the now false if statement.

One thing I see a lot from people that are switching over from legacy core is the nested ifs. It was necessary to do this with CoRE to build complex pistons. With webcore you can add as many top level ifs are you would like.

Hope this info helps you understand the new platform a little better.


#5

Thanks so much. Its a lot easier with explanations than just looking at the piston and trying to reverse engineer the logic, which is what I have been doing. :slight_smile:


#6

This is why we branched this community out from the SmartThings board. We can give better assistance to everyone without it being jumbled and lost in huge threads.

If you have more questions, just search around here, the wiki or ask if you can’t find anything that helps!


#7

Hi there. Just an update. The lights still aren’t shutting off. I haven’t been home much so it took awhile to confirm. Just to see I turned this off and wen’t back to using the old Core piston and it worked fine.
But clearly, there is still something missing with this WebCore one. I just don’t get it. Somethings seem so simple, and others become more complicated in WebCore. So strange.


#8

Post your green snapshot of what you currently have


#9

Right.


#10

Line 22 - 30: all that needs to be starting at line 20.

Line 32: this needs to be its own if statement separate from the first one

Line 20: once you move the stuff above then delete this if statement.

Looking at the original post this appears to be the same piston. Did you make any changes to it?


#11

You don’t need the third if statement, just use

else
with RGB Bulbs1 and 2
wait 45 seconds
turn off

actually you only need 1 if statement so get rid of the second one as well.

in the example I gave you earlier there was only 1 if statement. :slight_smile:

example:


#12

I had to delete and start a new Piston from scratch. It wouldn’t let me delete certain levels of the ifs so that is probably why I thought I changed things but really didn’t last time.

And yes to the Else if statement. Now in WebCore I can see that it doesn’t need to be there since the piston won’t trigger without the sensor going Active. Very grateful for those lighting bolts.

Here’s what I have for today. Thanks again.


#13

That should work. clean and simple.