How to run a piston forever?


#1

In short, I’m simply trying to control my outside lights. I want to have them at given times given light levels happen. But when any of the outside motion sensors finds something. Then all the outside lights goes to 100% for 3 minutes.

I’m trying to get this to stay in a loop. (I added a few refresh and resume. I wasn’t sure if that helped anything at all)
Something I would like to know since it’s been a while since I seriously looked at this. WIll a piston like this automatically start up on it’s own and keep running in a loop? Oh and how do I tell it to look for motion 30 min before sunset and 30 min after sunrise?


#2

The ‘Resume’ command resumes a piston that is paused, so it does nothing in this piston, since it can only reach that line if the piston is already running.


#3

Will a piston automatically loop on it’s own? Right now I’m getting the following

Quick Facts

Piston state: false

Last executed: 11/24/2018, 1:11:53 AM

Next scheduled: never

Subscriptions: 4 events, 3 controls

Devices used: 7

Memory used: 12% (12389 bytes)


#4

Personally, I do not think looping is the way to achieve your goals.
I would use precise triggers (motion), and use time as a condition.

Give me a few, and I will whip up a partial example for you


#5

Do you mean make multiple pistons?

Also, how can I set it to start looking for motion 30 min before sunset and 30 min after sunrise?


#6

Using your own words, what is this line supposed to do?


#7

I was trying to say if all the motion sensors say there is no motion


#8

ok, thanks. Give me a few more minutes please


#9

Just to clarify… 90% of your code is based on the levels you want the bulbs to return to once the motion has stopped, right?


#10

Yep. There is given times where the lights should be off giving there is no motion. But yes.


#11

OK, hang tight


#12

I believe this will do the trick for you…
(although you may want to double check my times and levels)

Also, I dropped the 59 seconds, since webCoRE is smart enough to distinguish between 7:59:59.999 and 8:00:00.000


#14

Thanks. WIll this automatically run by itself? (This is what I meant by a loop)

I think it’s been 6 months since I really messed with webcore and I forgot if the code runs 1 time. Or if it is always running in the background.

BTW I think the code you sent does everything I want. Thanks a million for your help.


#15

The two lightning bolts in the left column are the triggers that cause the piston to run and do the appropriate actions. The ‘USB’ symbol at the beginning of line 104 is a timer trigger, which causes only that one block to run at the appropriate time


#16

Thanks for clearing that up


#17

Sure thing, glad to be able to help.