Issues with connecting a slideswitch to change between automatic and manual mode for a fan

The issue left is the manual mode. The switch turns on the automatic mode according to the temp sensor. But if I switch the switch the potentiometer mode (manual mode) isn't working.
Is it my code or the way I'm connecting the switch?