Using Fanshim software on KodI libreElec

Sorry! On reading back my last comment, I agree I did come across as a dick. I’m just pissed off that after countless wasted hours trying and researching and joining lots of forums, I still can’t get the fanshim to work properly. I bought the Pi 4 primarily to use as an htpc and as it is can’t be used. I can’t unplug it each time after I use it and if it would work in libreelec as it does in buster all would be well in the world. Trust me lots of people across lots of forums are experiencing the same issues with the fanshim on Libreelec and I am sick of people telling me it works fine for them on Raspbian.

Apology accepted.
Even with the software installed and working, the fan isn’t going to stop running when you shut down the Pi. Not with the current updated eeprom boot code.
I’ve verified it myself. I had the Daemon running controlling the fan by temperature. I waited till the fan stopped and did a shut down. The fan just starts running again when the OS exits. What I think happens is the fan control GPIO pin is pulled Low to turn the Fan “off”. On a shutdown it goes to no state, undefined, floating, etc. As far as the Fan shim is concerned its a high so the fan runs.
You could debate 'why" do it that way but it is what it is. I think they did it that way so the fan runs with no software installed. I’m happy with that choice. Others may not be, and I get that.

With the original factory shipped eeprom code the fan would stop. Power was turned off via the PMIC.
To get that functionality you need to edit a file and reflash the eeprom.
Look at POWER_OFF_ON_HALT

raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md

But when you use the pimoroni setup in raspbian with a wide spread on temperature settings you will not need to shut down raspbian or turn off the pi. You just leave it to idle and sleep and the fan stays off because the cpu isn’t hot and calling for the fan to cool it. That is what we are looking for in Libreelec and it can be done , and has been done, we just need a more detailed how to. Someone will write it up eventually but my guess is it’ll be someone from the RPi community rather than Pimoroni.

1 Like

Ok, now I see where your going with this. Yeah, if you leave the OS running it should turn off when the CPU is below the turn on temp.
The few pi’s I have running 24/7 don’t ever go into sleep mode, and are just passively cooled. My Pirate Radio runs on a Pi Zero W and its only on when I want to listen to some tunes. Its a bit of a pian waiting for it to boot up so I can see where you’d just want to leave your music Pi running all the time and just idling when not in use.
I don’t have the skills to do what you want to do. This may not be ideal, but can you just run KODI from Raspbian? Installing the Fan Shim software would work. Just install the lite version of Raspbian.

I have made some progress with developing an add on so it turns the fan on and off with the temperature and has a settings page to manage it, but I really need to get back the CPU running percentage to add in a preempt option. Does any one know if there is a XMBC function to get this. I have tried some searches, but have only found people talking about the usage and not the code to get it back.

2 Likes

Wow, and add-on sounds perfect but whoosh right over my head on the CPU values. I’d like to offer to help you search for what you need but I’m not even skilled enough to understand quite what it is that you need or where you might find it. If you have any tips on how I could help you search I’d be glad to help.

I have a Blinkt hooked up to my Pi 4 showing CPU Load, the command it uses to get it is psutil.cpu_percent(). I don’t think that will help you though. Not directly.

Read something about htop monitors CPU is available in libreelec add-ons >programme add-ons >system tools. Also iftop in network tools CPU gpu temperatures.

Here’s a plan ask Phil on Twitter @gadgetoid. Pimoroni developer and Pimoroni product that you are spending your time developing an add-on for that will surely increase sales. He’s got to want to help you no? Phil Howard

phil@pimoroni.com

@gadgetoid

Phil is Pimoroni’s software guru, instantly recognisable by his somewhat pirate-themed moustache growing attempts. Usually found buried neck deep in Python libraries, he’s also been known to escape on occasion and turn out crazy new products. If you need a helping hand, he’s a prolific Twitter user and rampages around the forums like a T-Rex. Ask him if you need help with Pimoroni’s software libraries, or Propeller HAT.

1 Like

Thanks Jane your efforts are appreciated here.

I think my little addon is working with LibreElec and the Fan Shim. It’s based on the code from http://www.philrandal.co.uk/blog/archives/2019/07/entry_214.html

It needs the LibreElec rpi-tools installed and as it’s a zip you will need to enable zip loading.

2 Likes

Wow! Thanks so much I’ll try and load it now. Will this load via a usb memory stick with rpitools?

Yes just use the install zip and navigate to the folder,. You can load the Rpi tools directly from the libreElec repository.

2 Likes

hi, ive been having issues, guessing it is rpitools . ive added rpitools from program addons in le repo and can locate the usb stick in “install from zip” but when i click on srevice.fanshim the ok button is greyed out and it goes to resources.i can open it up in file manager view the xml and the icon ( i love the icon) can view licence etc. but cannot load the zip from install from zip. If i click on rpi tools addon i get a message console only addon. any idea what i’m messing up?

edit: im on libreelec 9.2 tried rebooting, updating rpi tools uninstalling rpitools and reinstalling even tied it on pi3b+ with rpitools installed. exactly the same result after navigating through to service.fanshim just greyed out and can’t load. and rpitools console only addon.

if i view files in file manager i can view all except " service.py" 5.86kb if i click on that i’m getting addon error message. looked into rpi tools and now understand there is no GUI so console only is normal.

Just registered here to let you guys know that I’m on the same boat. PI4 running Libreelec, tried phil’s solution and vinztech solution without luck… installed Jane’s addon (thanks a lot for the effort!!) however it’s not working for me, I have the raspberry pi tools addon installed, confirmed that python can run using SSH, but the fan still running at full speed all the times =(

have you still got to ssh? that would explain my problem. i just put the zip on a memory stick and plugged it into the pi.

no no, you haven’t, I just used SSH to confirm that I have python working… Since I used SSH a lot in the past couple of days to try to get Phill’s script working I just wanted to check if it was not “broken” or anything like that…

thanks for letting me know. i was about to spend the day learning how to ssh. higher up the thread a guy ephumuris is mentioned on libreelec forum. he also has posted a thank you on vinztechs page. but i think janes addon would be better or we will possibly have to keep updating with ssh as libreelec updates.

1 Like

If the ok is greyed out check you have turned in zip installs in system and that you simply put the zip on the usb and not the unpacked folder

If you have it installed try disabling it the enabling it after using option to set your preferred temps.

1 Like