Repeat Until?

That's going to generally run through one more repeat because you're checking it right as the repeat finishes (when the device is likely to still be in the same state), not before (or right after) it starts again. Any of the first three examples in the thread I linked to above show how to handle it in a way that won't do that, assuming this is concerning that issue: