I have been thinking about making one with a microswitch. I have some interesting specimens lying around here with a small roller at the end of the lever. I don't know why I didn't think of an optical one (have opto sensors lying around too )
The only issue I see is what if you print clear filaments. Most of those sensors use an IR light source. IR light behaves different.
To be tested ... but when?