Fan shim not working on OpenMediaVault

I have a RPi 4B and have installed OpenMediaVault from an image file (the one dated 2019).

Straight after installation I have installed the fan shim service as per these instructions.

I get no errors due to installation (that I could see), but when I check the service …

pegasus82@raspberrypi:~/fanshim-python/examples$ sudo systemctl status pimoroni-fanshim.service
● pimoroni-fanshim.service - Fan Shim Service
Loaded: loaded (/etc/systemd/system/pimoroni-fanshim.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-07-26 11:32:53 UTC; 23min ago
Process: 25330 ExecStart=/home/pegasus82/fanshim-python/examples/automatic.py --on-threshold 65 --off-threshold 55 --delay 2 (code=exited, status=1/FAILURE)
Main PID: 25330 (code=exited, status=1/FAILURE)

Jul 26 11:32:52 raspberrypi systemd[1]: pimoroni-fanshim.service: Failed with result ‘exit-code’.
Jul 26 11:32:53 raspberrypi systemd[1]: pimoroni-fanshim.service: Service hold-off time over, scheduling restart.
Jul 26 11:32:53 raspberrypi systemd[1]: Stopped Fan Shim Service.
Jul 26 11:32:53 raspberrypi systemd[1]: pimoroni-fanshim.service: Start request repeated too quickly.
Jul 26 11:32:53 raspberrypi systemd[1]: Failed to start Fan Shim Service.
Jul 26 11:32:53 raspberrypi systemd[1]: pimoroni-fanshim.service: Unit entered failed state.
Jul 26 11:32:53 raspberrypi systemd[1]: pimoroni-fanshim.service: Failed with result ‘exit-code’.

Stopping and starting the service doesn’t make any difference.

If I try some of the Python examples …

pegasus82@raspberrypi:~/fanshim-python/examples$ python button.py
Traceback (most recent call last):
  File "button.py", line 15, in <module>
    fanshim = FanShim()
  File "build/bdist.linux-armv7l/egg/fanshim/__init__.py", line 31, in __init__

RuntimeError: Not running on a RPi!

The image which I downloaded for OpenMediaVault says that it supports up to Raspberry Pi 3B+ so perhaps that has something to do with it.

Is there a way I can convince the fan shim service that I really am using a Pi4? Or any other solution?

I should also mention that the fan shim hardware seems to be installed OK. The fan will spin while the RPi boots, and (first time at least) the blue LED was lit. The manual button does not seem to do anything, however.

Thanks

This runtime error will be coming from the RPi.GPIO library and not Fan SHIM, I suspect, you could try the pre-release version with (if I remember correctly):

sudo pip install --upgrade --pre rpi.gpio

Thanks for the suggestion.

pegasus82@raspberrypi:~$ sudo pip install --upgrade --pre rpi.gpio
Requirement already up-to-date: rpi.gpio in /usr/local/lib/python2.7/dist-packages

I also tried --force-reinstall and got errors about something called “wheel”?

pegasus82@raspberrypi:~$ sudo pip install --force-reinstall --upgrade --pre rpi.gpio
Collecting rpi.gpio
Using cached https://files.pythonhosted.org/packages/cb/88/d3817eb11fc77a8d9a63abeab8fe303266b1e3b85e2952238f0da43fed4e/RPi.GPIO-0.7.0.tar.gz
Building wheels for collected packages: rpi.gpio
Running setup.py bdist_wheel for rpi.gpio … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-YyQGPL/rpi.gpio/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/tmpkZUtUApip-wheel- --python-tag cp27:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] …]
or: -c --help [cmd1 cmd2 …]
or: -c --help-commands
or: -c cmd --help

error: invalid command ‘bdist_wheel’


Failed building wheel for rpi.gpio
Running setup.py clean for rpi.gpio
Failed to build rpi.gpio
Installing collected packages: rpi.gpio
Found existing installation: RPi.GPIO 0.7.0
Uninstalling RPi.GPIO-0.7.0:
Successfully uninstalled RPi.GPIO-0.7.0
Running setup.py install for rpi.gpio … done
Successfully installed rpi.gpio-0.7.0

Hey there,

If you make sure your user is a member of the gpio group with

sudo usermod -a -G gpio YourUserName

and try the examples again do you still get the same error?

See Fan shim libraries don't seem to recognize Raspberry Pi

Hi Shefalex,

Thanks for the advice. I have moved on to another project for the moment, but will return to this in about a week. :)

Hi,

So, I have tried again.

After doing the installation of the pimoroni-fanshim service, there still wasn’t a group called gpio to add my user to. So, I created the group and added my user to it. Restarted the pi and tried to start the service, but when I check the status of the service, I get the exact same error as in the OP. Also, if I try running the python examples it still says “RunTime error: Not running on a RPi!”

I then tried sudo ./uninstall.sh followed by reboot then reinstall (user already in gpio group) but nothing changed again.

Then I tried running “sudo python3 automatic.py” and instead I got an error:

geoffh@raspberrypi:~/fanshim-python/examples$ sudo python automatic.py
Traceback (most recent call last):
  File "automatic.py", line 99, in <module>
    t = get_cpu_temp()
  File "automatic.py", line 50, in get_cpu_temp
    t = psutil.sensors_temperatures()
AttributeError: 'module' object has no attribute 'sensors_temperatures'

So I tried “sudo” button.py, led.py and toggle.py and they all work fine (not requiring temperature sensor).

So I went and found the github for psutil and installed from source.

git clone GitHub - giampaolo/psutil: Cross-platform lib for process and system monitoring in Python
cd psutil
sudo python3 setup.py install

And now … drumroll … success!