It’s bad practice, because you have locked up the rule execution just waiting.
Look instead into the use of timers, which consume no resource while waiting for their time to come.
Introduction here
For your research, here’s an example rule that checks the condition of a timer and cancels/resets it. The forum is full of examples so enjoy yourself and the community is here for when you hit a snag. Also, don’t be shy about clicking the heart icon on a post that you find helpful e.g. rossko57 post. It’s a great way to say thanks for your time and contribution.
var Timer myTimer = null
rule "Motion OFF"
when
Item Motion changed from OFF
then
if (myTimer === null) {
if (Motion.state == ON) {
myTimer = createTimer(now.plusSeconds(60), [ |
if (Motion.state == ON){
//do stuff
}
])
}
}
end
rule "BACK FROM ON"
when
Item Motion changed from ON
then
myTimer.cancel
myTimer = null
end