You might have the wrong type valve to be able to turn it off when it gets to the end of travel. Some valves have detents on the spool so it stays at the last position you signaled, but some have a third position in the center and automatically return to it if neither coil is energized. Then the three-position ones come in several flavors. Both ports closed, both exhausted, both pressurized, etc.
Also, I include a jam/sensor fault timer if the valve is energized and doesn't make it to the sensor within a reasonable time, as well as sensor diagnostics (for example, both end sensors should never be able to come on at the same time, so if they do, that's also a fault. The jam fault timer will catch sensors that don't come on when they should. And....if you do a jam fault, you should also monitor supply air pressure, and create a fault for that, and interlock that fault to prevent a jam fault, otherwise you'll be getting jam faults when the problem is actually lack of air.