Lights on with motion


#1

Ok, So I have a strange issue with my piston. I don’t know if it is a bug with the WebCore or if I need better programming.

I have a Virtual Switch (switch 1) that when my cameras detect motion IFTTT then turns the switch on. What I am trying to accomplish is if there is motion on the front porch, then it will turn on front lights (switch 4) on for 30 seconds for testing, then turn the lights off, and then turn the virtual switch off.

All this works, if I do not check if the lights are already off. If the lights are off, it will turn the lights on then it will wait and turn back off.

However if I check the status of the lights first, then it will turn the lights on, but never turns them back off. When I run the trace in this mode. Once the lights turn on, then the if statement for the lights turn red and the piston ends.


#2

Try it in this format…


#3

I was thinking about the changes to option this morning, I will try it tonight after work. Work always gets in the way of having fun…


#4

Looking at this code, the only issue is the issue I had previously. If the lights are already on, then they will turn off in the 30 seconds. That is why I am I checking to see if Switch 4 is off. Maybe I should check to see if it is on instead and then put the code in the else statement.


#5

Ah I see what you mean. Will try to adjust it when I get to a PC.


#6

I think I got it. I had to make 2 pistons. The first performs all the If statements, and the second one to cycle the lights.


#7

It looks like you can just add another condition right after the time and make sure to change the subscription from automatic to never subscribe.


#8

I forgot about this, here’s what I meant by my post above, turns out no need to mess with the subscription.