Hello tsgo8,
If your Teensy is reading the beam breaks and relaying bytes to the state machine to indicate their state, electrical interference could destabilize the input channel(s) and flood the state machine with data. I'd look at how the input channels are stabilized. You need a pull-up resistor to keep the channel at a stable logic level. You can do this in your Arduino code with:
pinMode(myChannel, INPUT_PULLUP);
This attaches a pull-up resistor internal to the microcontroller to the channel, however the pull is relatively weak. If you have a significant noise source (the valve power supply?) and you still have issues, you may have better luck with adding a physical resistor between the input channel and the Teensy 3.3V pin (I'd try 10k).
Please let me know if this works for you!
Thanks,
Josh