Pimoroni Fanshim Script and Bullseye

Hi all,

when I try to install the Fanshim script on Bullseye (Raspian) it fails with lot of errors that I cannot post, due to user limitations, but basically are:
-Package python-configparser is not available on Bullseye
-script is trying to install stuff for Python 2 wich is depreciated long time ago and not available in Bullseye
-rpi.gpio>=0.7.0 should have issues on Bullseye Python 3.9
-you are missing Build-Essential package

So I had to format and re-install Buster back in order for the script to work, is it possible to update it?

Thanks in advance

The final Bullseye image dropped into my lap with little notice, and I’d previously been running a manually upgraded (from Buster) version that- of course- still had Python 2 sigh

Fix incoming here: Fixx installl.sh for bullsye/default Python 3 by Gadgetoid · Pull Request #104 · pimoroni/fanshim-python · GitHub

I have… a lot of install scripts to fix!

In the mean time, adding a dtoverlay to your config.txt file will get you some temperature control of the fan. The button can also be used as a shutdown button with a second edit.
Fan Shim BCM 18 Pin 12 Fan Control
Fan Shim BCM 17 Pin 11 Button


55000 is 55c on, you can change that to what ever on temperature you want. It will go off again when the temp is 10c below your on temp.
The fan control option in Raspberry Pi Config will work and make the edit for you. Just use GPIO 18.
By default with no edits, pressing the fan shim button will boot up your Pi. Assuming you don’t unplug the power supply after doing a shutdown.

Do you know more or less how long will it takes?

You mean on a fresh installed Bullseye I can simply add those lines in the config file to make the fan working also without the Fanshim script?

Yes, they will work with no fanshim software installed. You only need the first one for temperature control. The second line is an optional extra for the button.
You need to reboot just the once after doing the edit. They only get read on bootup.

It works, thanks for the suggestion.
Once the Fanshim script is ready I can simply delete the line and install the script, right?

Yes, just delete that line and install the fanshim software.

Another question, is there a line to add in order to control the fan speed?

No, not via the config.txt anyway. To control the speed you would have to use PWM on the fan control pin. You basically turn it on, off, on, off very quickly. More off than on means slower speed. It’s doable via python etc, I haven’t tried it myself though.

Hi, is there any update on this? I have bought the fan but still cannot properly use it on Bullseye. Thanks

I have installed several packages on Debian Bullseye, and I think the most relevant are:

However, installation using the script still fails.
Here’s the latest output:

root@nelson:/home/fanshim-python# ./install.sh
./install.sh: Zeile 67: python: Kommando nicht gefunden.
  Python Library: Installer

Installing for Python 3..
running install
running bdist_egg
running egg_info
writing fanshim.egg-info/PKG-INFO
writing dependency_links to fanshim.egg-info/dependency_links.txt
writing requirements to fanshim.egg-info/requires.txt
writing top-level names to fanshim.egg-info/top_level.txt
reading manifest file 'fanshim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'fanshim.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/fanshim
copying build/lib/fanshim/__init__.py -> build/bdist.linux-aarch64/egg/fanshim
byte-compiling build/bdist.linux-aarch64/egg/fanshim/__init__.py to __init__.cpython-39.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying fanshim.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying fanshim.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying fanshim.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying fanshim.egg-info/requires.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying fanshim.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/fanshim-0.0.5-py3.9.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing fanshim-0.0.5-py3.9.egg
Removing /usr/local/lib/python3.9/dist-packages/fanshim-0.0.5-py3.9.egg
Copying fanshim-0.0.5-py3.9.egg to /usr/local/lib/python3.9/dist-packages
fanshim 0.0.5 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.9/dist-packages/fanshim-0.0.5-py3.9.egg
Processing dependencies for fanshim==0.0.5
Searching for spidev
Reading https://pypi.org/simple/spidev/
Downloading https://files.pythonhosted.org/packages/62/56/de649e7d95f9fcfaf965a6eb937b4a46bc77ef21487c99cde1a7a0546040/spidev-3.5.tar.gz#sha256=8a7f5c289f161ea2ac4697fa8a10918232c990678dd0053084b3c43b1363910d
Best match: spidev 3.5
Processing spidev-3.5.tar.gz
Writing /tmp/easy_install-9hbk90ib/spidev-3.5/setup.cfg
Running spidev-3.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-9hbk90ib/spidev-3.5/egg-dist-tmp-o_k4jjkp
spidev_module.c:28:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
   28 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
error: Setup script exited with error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Can you please advise how to fix this?

Issue fixed after creating softlink to /usr/bin/python:
root@nelson:/usr/bin# ln -s python3 python