This is part of filament_watch, which pauses or stops OctoPrint if the filament jams or runs out during a 3D print. Code and setup instructions at https://github.com/rllynch/filament_watch.
These STLs hold a "Signswise 600p/r Incremental Rotary Encoder" from Amazon. The encoder measures the filament being consumed by the printer. If the actual filament consumed is significantly less than the filament specified by the gcode (e.g. jam or clog), the print is cancelled.