This filament run off switch uses the Octoprint plugin filament sensor software (not the reloaded one). This is running on a raspberry Pi 3. I use a manual switch that I took the roller off of and bent the head forward to give the filament more room to glide over. It is some what of a sharp edge, but it seems to work just fine.
Filament sensor reloaded plugin, the one in the video:
All you have to do is cable up to the 18 and 20 pins, 24 GPIO and ground. The code uses the internal pull up sensor, so you should be good.
Old filament plugin, kinda unpredictable.:
I use a pull down resistor, with physical pins 1 3.3v, 6 ground, 32 gpio 12 in this config. See jpg for .octoprint/config.yaml file and wiring diagram. On octoprint command line enter gpio read 26 to check pin status, 1 will be filament there, 0 is filament gone.
I will be added some more housing options soon.
Video here: https://youtu.be/ChjwIGxnivw
Added a sensor 3 file, tweaked it a little to keep the filament a little straighter.
Switch link http://www.ebay.com/itm/5-Pcs-Micro-Limit-Switch-Metal-Roller-Arm-Subminiature-SPDT-Snap-Action-LOT-/321356308879?hash=item4ad254218f
Octoprint plugin link: http://plugins.octoprint.org/plugins/filament_sensor/
I added an optional screw on switch cover. Switch fits pretty tight without it.