Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Docker with liquidctl and smartctl - Control your (NZXT USB) fan speeds with HDD temps

Featured Replies

Hello!

 

I've been trying to find a solution to the issue of linux and reading/controlling fans, I stumbled upon liquidctl and the existing docker got me on the path to build something myself that reads hard drive temps, averages them and sets fan speed based on that.

I am using the NZXT RGB & Fan Controller - AC-CRFR0-B1-6 and focusing only on controlling the fan speed (fan1, fan2, fan3).

 

Here is a docker: pstewardyul/liquidtemp:latest

Variables needed to set are:

THRESHOLDS_ENV - Set the temperature thresholds that will change the fan speeds - DEFAULT "20,25,30,35,40,45"

FAN_SPEEDS_ENV - Set the speeds that will change with the threshold temperatures - DEFAULT "20,30,40,50,60,100"

EXCLUDED_DRIVES_ENV - If you need to exclude drives from the average calculation - NO DEFAULT - EXAMPLE "/dev/sda,/dev/sdb"

FAN_QUANTITY_ENV - Set to 1, 2, 3 (how many you are connecting to your controller) - DEFAULT "3"

 

The container requires "privileged" to read/control related hardware. Also recommend to set "--log-opt max-size=50m" in extra parameters to limit the log size as every minute the script will run to check/update fan speed, these changes are viewable in the log.

 

If you don't set any variables - no worries - it will load defaults (except the log limit).

This an AMD64 docker image, not sure how to work with the other platforms, and just started with making scripts and building docker this afternoon so even though it works on my system, not sure of others!

 

FYI - The script just works with /dev/sdX not NVME, also some /dev/sdX don't produce the smart output compatible (like my kingston MSATA).

The script can be found at "/usr/local/bin/fan_control.sh".

 

EDIT: Changed from hddtemp (causing issues with spun down drives) to smartctl and added more error checking.

 

--Phil

Edited by PSteward

  • PSteward changed the title to Docker with liquidctl and smartctl - Control your (NZXT USB) fan speeds with HDD temps
  • 3 weeks later...

Hi,

was just looking for something like this, Dynamix Auto Fan Control is not working with my mb.

 

I dont see this in the docker section on Unraid and dont understand your link above.  can you advise on how to install?

thanks!

 

 

  • Author

Hey Ginhead,

Do you have NZXT RGB & Fan Controller or equiv that works with the liquidctl docker?


If you do:

Go to the docker tab, click Add Container.
Name: liquidtemp
Repository: pstewardyul/liquidtemp:latest

Privileged: ON

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Thresholds
Key: THRESHOLDS_ENV
Value: 20,25,30,35,40,45
Save.

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Fan Speeds
Key: FAN_SPEEDS_ENV
Value: 20,30,40,50,60,100
Save.

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Excluded Drives from temp calc
Key: EXCLUDED_DRIVES_ENV
Value: {ENTER WHAT EVER DRIVES YOU DON'T WANT TO CHECK TEMP,. example "/dev/sda" }
Save.

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Fans
Key: FAN_QUANTITY_ENV
Value: {ENTER QUANTITY OF FANS UNDER CONTROL, example "3" }
Save.

Click Done, after it loads, check the logs for its run status.

Edited by PSteward

  • 1 month later...

hi,

thanks for that great detail, I was just able to successfully pull and install.  going to order that fan controller,

 

thanks for the help!

 

  • 3 months later...
On 6/27/2023 at 3:15 PM, PSteward said:

Hey Ginhead,

Do you have NZXT RGB & Fan Controller or equiv that works with the liquidctl docker?


If you do:

Go to the docker tab, click Add Container.
Name: liquidtemp
Repository: pstewardyul/liquidtemp:latest

Privileged: ON

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Thresholds
Key: THRESHOLDS_ENV
Value: 20,25,30,35,40,45
Save.

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Fan Speeds
Key: FAN_SPEEDS_ENV
Value: 20,30,40,50,60,100
Save.

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Excluded Drives from temp calc
Key: EXCLUDED_DRIVES_ENV
Value: {ENTER WHAT EVER DRIVES YOU DON'T WANT TO CHECK TEMP,. example "/dev/sda" }
Save.

Click on Add another Path, Port, Variable, Label or Device:
Config Type: Variable
Name: Fans
Key: FAN_QUANTITY_ENV
Value: {ENTER QUANTITY OF FANS UNDER CONTROL, example "3" }
Save.

Click Done, after it loads, check the logs for its run status.

I just wanted to thank you! This was a pretty great workaround for my setup which is ran out of a dual bay HDD enclosure. 

The only option for cooling the drives was a on board temp sensor which wouldn't go off until the drives were well into their 50's

  

This way I don't need to run on max 24x7

  

Thanks again!

  • 1 month later...

Thanks @PSteward for this nicely working script and docker image.

 

I noticed that every time the cron job triggers the fan-control script, the `liquidctl initialize all` will ramp up the fan speed to 100% before continuing to set it to e.g. 60%.

It seems like to occur with the `NZXT RGB & Fan Controller` of mine. I did not test it on other devices, so this might be just specific to this one.

An improvement would be to perform the `liquidctl initialize all` only once at the startup (before cron is setup), instead of the periodically triggered fan-control script.

 

Thanks a lot!

Greg

  • 5 weeks later...
  • Author

Hey Greg,

 

Never noticed! I put that in because I noticed sometimes when I rebooted or started the server not all fans would work (showing 0 RPM) - honestly it doesn't really fix that issue though. It is REALLY important to check the logs at reboot to ensure that all fans are reporting more than 0 RPM and if not shutdown - then start again (reboot doesn't always resolve). I never had the issue once all fans are running but only on the occasional startup or reboot (I may do that every few months, so definitely important to verify).

 

I'll review the coding and see if I can make some improvements based on how its been working of late - in addition at one point I'd like to extract the data into a plugin and show it on the interface (% + Speed).

  • Author

Updated to add a check for the liquidctl initialize, and fixed it so it doesn't set speed if already correct, plus additional checks for zero RPM. Just update your docker.

Edited by PSteward

  • 1 month later...

Works perfect, thanks a lot!

  • 2 months later...

Hello!

I have an NZXT RGB & Fan Controller and installed the docker like described in the second post!

But it doesnt work sadly, here is my log: Log from the Docker container through pastebin

 

One of the Fans (on Fan1) is running, the other two are not running. I shutdown the system and booted up again. I restartet the container.

Attached is a picture of my container settings. Maybe i did something wrong?

 

Thanks in advance!

 

P.S.: @PSteward do you have any insights about my problem?

 

image.png

Edited by philix

  • 4 weeks later...
  • Author

Seems like it isn't seeing the device. Did you check under USB (in Unraid) to see if it's there?

Edited by PSteward

  • Author

Also as an update today I found if you use Dynamix System Temp and scan add the fans from the NZXT to add in it will BREAK the sensors.conf file (not related to my docker).
Steps to fix (and then you can show fan RPM on your dash!):

Go to terminal (in Unraid)

# vi /etc/sensors.d/sensors.conf

change any line with

chip "nzxtsmart2-hid-#-#"

TO

chip "nzxtsmart2-*" 

Press ESC and then

:x


# sensors

Should output properly, not with an error. Now it will fix the Dynamic System Temp.

Edited by PSteward

  • 2 weeks later...
On 6/24/2024 at 2:55 AM, PSteward said:

Seems like it isn't seeing the device. Did you check under USB (in Unraid) to see if it's there?

I remember looking in the system devices and i remember that i saw the NZXT  RGB & Fan Controller.

I left the USB from the NZXT unplugged so the fans would run 100%, because without the control the disks would obviously get very hot.

After i applied your update to the docker, i replugged the controller in, and it was found in the docker and started to work! I looked again in system devices and its still there. So i really dont know why it didnt work.

 

I also have the problem, that some fans keep at 0 rpm and dont take a change to, say, 30%. My solution was to unplug the usb so all fans spun at 100% and reconnect usb.

 

Also, my /etc/sensors.d/sensors.conf doesnt have any "nzxtsmart2" line, and even after adding a line manually it doesnt show.

Strange, istn it?

 

Thanks anyway!

  • Author

My issue is that sometimes the fans don't get detected properly on boot, I've had them show 0 rpm and also show as DC instead of PWM. The fix for this seems be shutting down and then starting back up OR if that didn't work shut down and pull out and put power back then boot up.
Being that once I have a successful boot it runs fine, it's the first thing I check once I reboot (I also don't reboot often, maybe once every few months).
For the sensors.conf , it gets populated by the System Temp plugin, when you check that did it detect and try to load up your fans? You need to run it first and save (which breaks the sensors.conf file), then edit the file and save (you'll need to do it after rebooting too as it gets re-written). Mine finally works and I can see those RPMS in the dashboard and bottom of my browser.

  • 6 months later...

I have an NZXT Krake AIO on my unraid server. It annoys my OCD that the screen is rotation facing 0900. I cant adjust the AIO bracket to make the screen verticle as the hoses will push against one of the RAM slots.

 

Does the liquidctl app/plugin allow for the screen to be rotated or is it just for fan control?

  • 6 months later...

Thank you so much for sharing this, I've been looking for a solution like this for quite a while! I'd love to see support for NVMe drives as well, especially for thermal monitoring. Being able to fully automate all my fans would really help cut down on unnecessary noise.

Just curious, was there a particular reason you didn’t release this as a community app? I think a lot of people would benefit from it.

Thanks again!

Update: I have purchased the fan controller and it work great with this docker. Things I noticed. Even though fan one isn't connected it complains in the log, is there a way to have selective fans rather than quantity.

If we have the temperature and fan control for the nvme and it being dedicated to a selective fan would be great.

Edited by Zuluuk
update comment.

Hi @PSteward
I don't know what the issue is;
image.png
I can understand sda would report as fail as this is the usb drive but why are my other hdd showing as error? It was okay when I did a dry fitting. The concerning part is the average temperature is reporting as 6 when the array is showing as 33+

Adding more information, i think i worked out the issue:
image.png
Everything except for the sdc has a 231 temperature of 0, this is actually not a temperature reading. Can you explain what script you are using to calculate this? Can we exclude smart value for 231?

I did more research and we can get individual fan control.
liquidctl set fan1 speed 60
liquidctl set fan2 speed 50
liquidctl set fan3 speed 40

With regards to the nvme you can get temperature by
image.png
Looking forward to your reply.

Edited by Zuluuk

I think I fixed the issue;


I edited the file /user/local/bin/fan_control.sh

image.png

I added the value 194 to look at just that temperature line and ignore the others.

image.png

fan_control.sh
I modified this a little;

FAN 1 controls the HDD

FAN 2 controls the NVMe

FAN 3 Controls the MB/case
I also added the data path so I can edit the script easier.


image.png
image.png

image.png

My apologies if I am hijacking your thread.
This is most likely my last contribution.

I was able to reduce the docker size massively.

image.png

Dockerfilefan_control.sh

I’ve created a custom Docker container for minimal-liquidctl and wanted to share how you can integrate it into the Unraid GUI:

1. Build the Docker image

Open a terminal and run:

docker build -t minimal-liquidctl .



2. Tag the image for Unraid (fake registry tag)

After building, tag the image like so:

docker tag minimal-liquidctl local/minimal-liquidctl:latest


3. Add to Unraid via GUI

  • Create a Docker template XML file (e.g., minimal-liquidctl.xml).

  • Place it in the following path on your Unraid flash drive:

/boot/config/plugins/dockerMan/templates-user/

minimal-liquidctl.xml

I am new to this, and when I have time I will most likely post this on dockerhub / the app repository.

Edited by Zuluuk

🚀 Fully Automated Setup for Fan Control Docker

This setup is now fully automated — just waiting for Squid to publish it to the Community Applications repository.


🧪 If it's not published yet:

You can still use it manually by placing the template file into the following directory:

/boot/config/plugins/dockerMan/templates-user/

Once added, simply deploy the Docker container using the Unraid Docker tab as you would with any other template.


📦 What the Docker container does:

  1. During startup, it downloads docker-entrypoint.sh automatically via Docker Compose.

  2. When the container starts, it checks if fan_control.sh exists in the /usr/local/data directory:

    • If the script is missing, it will automatically download the latest version from GitHub.

    • If the script already exists, it will skip the download and use your existing file.


This allows for hands-free updates and deployment, and ensures your fan control script is always available.

my-minimal-liquidctl.xml

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.