Filament out sensor?

Not sure if this is possible with the hardware but currently I can use an octoprint plugin to send a pause command when an optical sensor sends a GPIO pin low on the Pi i.e when the filament runs out. Would be a great add little add on to the firmware if there is GPIO on the expansion port.