Hot End Fan Switch with GPIO

I want to switch on and off the hotend fan triggered by hotend temperature

I found a plugin but only to switch manually and i need and automatic version

I am not able to programm something like this on my own maybe somebody did already and share with me.
My Printer is an Ender 5Pro silent Board
env.plugins.pi_support.model: Raspberry Pi 3 Model B Rev 1.2
env.plugins.pi_support.octopi_version: 0.17.0
env.plugins.pi_support.throttle_state: 0x0
env.python.pip: 19.3.1
env.python.version: 2.7.16
env.python.virtualenv: true
octoprint.safe_mode: false
octoprint.version: 1.6.0
printer.firmware: Marlin TH3D U1.R2.17