I have an acoustic accordion with midi. The system has Hall effect switches. If one goes out of alignment I can fix it. If two or three go out, I’m stuck, because they usually go in the “always-on direction. To make it worse, the installation has a bundle of wires in a position where they can easily bump into those detectors if the accordion gets bumped, and the wires are too short to be rerouted. Needless to say, I’m very careful with this accordion. If I have to transport it, it’s always in a hard case with foam blocks around it to absorb shock and prevent it from moving inside the case. But this type of midi is still a lot more reliable than the contact type.
I recall reading somewhere that there were some midi systems for accordion that employed optical detection but it didn’t work out too well. I wonder why.