Ok, sorry I misunderstood. This is probably the solution; where you are not getting a state change for x amount of time: