Posts by HopWorks

    You are welcome. It was just a guess on my part that you also moved the fan_control.sh shell script to the subfolder called ‘scripts’. You are right that it makes no difference where it is located as long as the path in the autostart.sh script matches.

    If you set FAN_OFF = 0, the fan should be stopped until the CPU temp value cross the threshold of MIN_TEMP. So you could lower the value MIN_TEMP near to the idle temperature for testing purposes, to trigger ON/OFF earlier and check the functionality of the script.

    Hey Harry, is there a document or guide out there that could take me through the intricacies of running background Python processes (autostart), how to include modules without PIP, how to write an addon (that accomplishes bringing in modules), how to bake in what I usually need, how to avoid using docker if possible, and the do's and don'ts of LibreElec?

    It's VERY frustrating but I do not complain because I totally get why LibreElec is the way it is. I have had Kodi installed in an OS like Ubuntu, Raspbian, and have had amazing issues. Most of those were years ago, but that is because once I found LibreElec, I just haven't had reason to go back to my previous strategy for a few years.

    But now I have progressed considerably with embedded systems, microcontrollers, hardware (and systems) design, and hungry to add interfaces with a core system. This adventure (this thread) about how to add an aftermarket PWM fan for cooling was just the surface. I want displays, IR, Radio control, power management, HEVC, etc. It's for me, not the public, but I learned today I need to know the inside-info about all of it in order to do it right.

    I apologize if this info is already available and advertised. Just not sure where to look.

    Thanks again!!!

    If this works, the next step should be to test the wrapper script:
    sh /storage/scripts/fan_control.sh start and sh /storage/scripts/fan_control.sh stop

    I sorted it out. I had to set the execute flag on fan_control.py

    Code
     # chmod +x fan_control.py

    And the fan_control.sh is in /storage/.config/ by the way because that appears to be where the OP has it. I don't see that it matters so long as autostart.sh knows where it is. fan_control.sh works fine also and then I was greeted by my system temp every 2 seconds (ooops) so after careful timing of pasting sh /storage/.config/fan_control.sh stop and a quick press of ENTER and the temp reporting stopped. I went back in to fan_control.py and commented out my print statement, came back and did

    sh /storage/.config/fan_control.sh start and it is working. At least the scripts are. Not sure about the fan speed yet. Now I just need to reboot and check for the process with htop.

    Thanks HarryH!

    To find out where the problem comes from, what is the output of python3 /storage/scripts/fan_control.py ? Are there any exceptions/error messages? Or is this what you mean by?

    The script works or at least it does not exit with any exceptions. I modified the temperature function slightly in order to output the current temp while running. When I said I was able to control my fan just fine, I meant at the most direct level. From the Python interactive environment, PWMOutputDevice(GPIO18, 25kHz), and changing the value of the resulting object by .01-1. I was actually surprised to see the fan spin at .01 but it IS a Noctua. My guess is the fan's controller has a floor limit for PWM duty cycle but without speed reporting, it's hard to test because the fan is so quite.

    I will check the wrapper script next. Thank you for your help with this! I appreciate it.

    Thank you Nathan for the code! Yes, this thread is old but considering what you did, and what I am trying to do, this is the freshest attempt I have seen after a whole day of researching.

    Your code did not work for me. The fan just keeps running. But your nicely written code opened up a lot for me and I appreciate that! I am also using a Noctua Fan, a 5vdc PWM 40mm. To be honest, I am addicted to the Noctua line. I was able to control my fan just fine from the interactive python so I know I have everything hooked up correctly. But for some reason, using your code, the fan just stays on.

    I have not gone after making the speed reporting line from the fan safe for RPI input yet. The specs say the interface works at 5vdc but is tolerant of 3.3vdc on the PWM line. But considering the speed reporting line will still throw 5vdc, I need to either place a level shifter on it, or at least a 3.3vdc zenier diode. Anyway, with that speed line, on maybe GPIO 23 or 24, or 4 maybe? I will be able to see the RPM's. Funny thing, this fan is REAL HARD to tell if it is at 1% or 100% speed without a completely quite room or putting my ear to it. lol

    My only change is that I placed the fan_control.py in a subfolder of storage so it is at ~/scripts/fan_control.py and I updated any references I could find. I probably missed something.

    When I boot, this is what my systemctl status kodi-autostart.service: shows...

    Thanks again for the great offering! I appreciate it!

    I got my answer in a big way on the Kodi forums. Thank you sir for the suggestion!!

    I have done a number of Kodi installs in various environments, but this latest try using LibreElec on a Raspberry Pi 4 8gb has been the most rewarding. Now with my ability to shell into the client, pull the user database, send commands using sockets, and being able to explore all that both OS and Kodi have to offer, I FINALLY have the media client setup of my dreams become a reality. And because of this, my nVidia Shield is going to be collecting a whole lot of dust moving forward. lol

    Thanks again!

    I have finally been able to control Kodi from remote on my home LAN using Python scripts on WSL2, and when I do a VideoLibrary.Scan, I do get the expected "OK" back via JSON, but is there a way to poll Kodi or look at processes to see when that scan is completed?

    I am using this method, and VideoLibrary.Clean from a VB.NET Windows Forms application to interact with the Kodi database (ready only) to search for specific media assets, etc. When I make changes to my NAS resources as a result of this app, I want to periodically (on-demand) clean, then update Kodi's database, then pull it locally to update what my app sees. But I do not want to pull it's user database until the scan is complete. I am pulling the database locally because it is faster for my app to access and I wanted that barrier in case I somehow change the database, and I do not want to corrupt it on my LibreElec install of Kodi. I would rather let Kodi make the database updates based on what it sees on my multiple NAS resources.

    I apologize if this has been asked before. I did extensive google searches and a few forums and did not get any hits.

    Thanks for your time!

    Hi All,

    I have libreelect installed on a Raspberry Pi 4 8gb, version 11.0.6 (RPi4.arm) and I can shell into it using Putty with no issues.

    I searched and did not find an answer, so... how can I see what version of Kodi I have installed via the command line? I tried kodi -v and kodi --version but kodi is not found.

    My wife is watching a movie and did not want to interrupt and I expected to be able to get the version from the command line. Is there a way?


    Thanks!