groovysmartthings

How do I make my while loop fire once a minute?


I have this while loop:

while (now() > timeToday(checkTime).time && now() < timeToday(arrivalTime).time){

I would like for this loop to run only when the real time clock's seconds hits 00 Basically allowing the loop to run once per minute. I am doing this because the IDE I am writing in only allows a 15 second pause maximum. Unfortunately sleep() is not an option at all in the SmartThings IDE

I was thinking something like this

while (now() > timeToday(checkTime).time && 
       now() < timeToday(arrivalTime).time && 
       Date.parse('ss', now() = 00).time){

But I'm fumbling with it.

If there is a better way to do this than the conditional please let me know.


Solution

  • SmartThings finally gave an answer back and said to use their runIn(60, myHandler) logic.

    Thanks for everyones input.