Unable to control fan on fan shim

I recently upgraded my Pi with a Pibow case and a Pimoroni fan shim. I have installed the software for the fan shim and I’ve tested it out but all I seem to be able to do is to control the LED while the service is turned off. I seem to be unable to control the fan at all, even after deactivating the service. Running scripts like the following do nothing to the fan:

from fanshim import FanShim

fanshim = FanShim()
fanshim.set_light(255, 0, 0)

I don’t know whether this is a software problem or how to resolve it, so any help with this issue is appreciated.

The fan will run by default with no control signal, a fail safe always on mode if you will.
To actually turn it off you need to pull the fan control pin GPIO 18 low.
Fan SHIM at Raspberry Pi GPIO Pinout
It may be that the fan control pad isn’t making contact with the Pi’s GPIO pin.
I’ve had that happen, I usually just ever so slightly bend that one pin a bit to the side. Or plug a female header in “on top” of the Fan Shim.

Adding the following dtoverlay entry (and rebooting) to your config.txt file will control the fan without any Pimoroni software.
55000 is on at 55c and off again at 45c, you can change that 50c is 50000.
If you do this from terminal
cd fanshim-python
cd examples
you can change the service settings by stopping it and rerunning the setup command.
sudo systemctl stop pimoroni-fanshim.service
sudo ./install-service.sh --on-threshold 75 --off-threshold 60 --delay 5
or disable it with
sudo systemctl stop pimoroni-fanshim.service
sudo systemctl disable pimoroni-fanshim.service
and reenable with
sudo systemctl enable pimoroni-fanshim.service
sudo systemctl start pimoroni-fanshim.service

So if I change my script to something like

from fanshim import FanShim
from RPi import GPIO

GPIO.setup(18, GPIO.OUT)
GPIO.output(18, GPIO.LOW)

fanshim = FanShim()
fanshim.set_light(255, 0, 0)

it should work?

That should turn it off. I don’t think you need the fanshim.set_fan(False) line, not sure what it does to be honest.
If you installed the service you’ll want to stop it and disable it. Stopping it only works until you reboot or shut down.

According to the README that comes in the repository, the fanshim.set_fan(False) is supposed to turn off the fan. And is it true to say that if I want to control the fan/LED manually, I have to disable the service and run a script like the above, and when I want to go back to having the service control the fan, I reactivate it?

If you want to manually control the Fan etc, yes you need to at least stop the service. If you leave it running in the background I’m pretty sure its just going to interfere with what your doing.
I have run mine with just the dtoverlay and with the service / daemon. I haven’t done anything manually via python though.
There is now an option in Raspberry Pi Configuration to control a fan. It does the dtoverlay entry for you. Just enter GPIO 18. You have to reboot for it to take effect which is why its a good idea to disable the service.
And you have to be in the fanshim-python/examles folder when you run the commands to stop and disable etc. If your not it will just give you an error.