CR10S no filament runout detection when octoprinting

I've just found out that even though the my CR10S came with a filament runout sensor which works ok when printing locally doesn't stop the printer when printing from octoprint. Can any one point me in the right direction to instructions to making my own cable up to connect to my printers sensor and connect to the pi GPIO pins so when I want to print from octoprint I can just swap the plug over on the sensor. I'm assuming that there is then a plugin I would then need to install and configure to get octoprint to then take the appropriate action on runout or a break.
Thankyou

Richard

BTW: Is the runout detection activated in the printer via the LCD menu`?

I think so. I'm sure its worked before we started using octo print. I'll double check when it stops printing.

I was advised to use the enclosure plugin (although there are several others). I assume that you understand why it is necessary to have runout detect to Octoprint not locally?