Inactive for/stays for based piston not working as before


I had this piston working just fine for a while but in the past week or so, it stopped triggering until ~3:20am even though all the sensors and switches are inactive or off after midnight for sure.

I had done an update of webcore recently so I am wondering if there is a new bug in that build that prevents this piston from running. In the normal logs what I saw was piston rescheduling itself continuously for 5 or 15 minutes. I’ve enabled verbose logs now so don’t have that info just yet but I confirmed that none of the sensors had motion event in that time frame and switch was off.


It is not a bug… The two triggers you have (lightning bolts in the left margin) only trigger at specific times.

Once precisely 15 min after the last motion sensor calms down, and once exactly 5 min after the switch turns off. This means, if your house is empty at 7:44, then it will try to trigger at 7:59, but the time restriction will block it from actually running any code.

If someone walks past the motion sensor (between 7:45PM and 2:43AM) it should run properly ~16 minutes later… (I say 16 instead of 15 because it takes a bit for the sensor to report inactivity)

Pro Tip:

Whenever my time range crossed midnight, I normally invert the code on line 20:
IF Time is NOT between 3AM and 8PM

Certain code acts strange if the time span crosses midnight, so by using the inverted shown above, you will prevent any of those issues from ever appearing.


That’s the behavior I want though. When there is a change in sensors after 8pm and when they stay inactive for 15 minutes I want the action to run. It is never the case that these sensors stay inactive after 8pm to 3am.

I will try inverting the time though, from how the action was executing around 3:20am it is possible that is the root cause.

Although I would still say this is a bug in the new version since this piston had been working just fine before I updated webcore.


I don’t understand what you are saying here… do you mean:

  • never stays inactive after 3am
  • never stays inactive from 8pm to 3am?

As to your other question… If this is your goal:

  • After 8pm
  • first there must be motion
  • then inactivity for 15 minutes
  • and the time must be before 3am…

then your first piston looks solid (using the newly inverted time)

The past week, time based pistons have been wonky thanks to some code change on the SmartThings end…


I meant to say between 8pm and 3am, one of those sensors always has a motion event triggering to whole logic. But what you stated was exactly my goal. Let’s see how things run today with the new inverted time rule, I also enabled verbose logging.