NZXT Kraken 240 - RL-KN240-B1 on linux / proxmox

NZXT Kraken 240 - RL-KN240-B1 on linux / proxmox

·

3 min read

Steering your water-cooler from linux is quite easy thanks to the folks who created liquidctl

The only downside is that the current version liquidctl/stable,now 1.12.1-1 you can install on Debian does not support the mentioned AIO, but there is a fix..

  1. Install liquidctl from you repo

  2. Find you kraken3.py file in your liquidctl drivers install (/usr/lib/python3/dist-packages/liquidctl/driver/kraken3.py)

  3. Replace it with the current git version (https://github.com/liquidctl/liquidctl/blob/main/liquidctl/driver/kraken3.py)

  4. Profit.. or working cooling

When you do:

root@pve:~# liquidctl list
Device #0: NZXT Kraken 2023 (broken)

The device shows as broken but you can control it. While you can set fan and pump speed levels based on the liquid temperature I could not find a way to set the pump speed based on the cpu temp (maybe is didn't look hard enough..)

So i wrote a dirty, little go program to help with that..

  1. It is waiting 15 secs

  2. Sets my fan speed curve based on the liquid temps

  3. Sets my display brightness

  4. Sets my display orientation

  5. Polls my CPU temp to adjust the pump speed

package main

import (
    "fmt"
    "os/exec"
    "strconv"
    "strings"
    "time"
)

const SILENT = true

func main() {
    time.Sleep(15 * time.Second)
    setDisplayRotation()
    setDisplayBrightness()
    setFanCurves()
    for range time.NewTicker(1 * time.Second).C {
        tickerSecond()
    }
    select {}
}

func getCPUTemp() (cpuTemp float64, err error) {
    ttmp, err := exec.Command("bash", "-c", "sensors | grep 'CPUTIN:' | awk -F'[:+°]' '{print $3}'").Output()
    if err != nil {
        if !SILENT {
            fmt.Println(err)
        }
        return 0.0, err
    }
    // parse the output to float
    cpuTemp, err = strconv.ParseFloat(strings.Replace(string(ttmp), "\n", "", -1), 64)
    if err != nil {
        if !SILENT {
            fmt.Println(err)
        }
        return 0.0, err
    }

    return cpuTemp, nil
}

func setPumpSpeed(cpuTemp float64) (err error) {
    if cpuTemp < 40.01 {
        if !SILENT {
            fmt.Println("CPU Temp is below 40.00°C")
        }
        out, err := exec.Command("bash", "-c", "liquidctl set pump speed 25 --verbose").Output()
        if err != nil {
            if !SILENT {
                fmt.Println(err)
            }
            return err
        }
        if !SILENT {
            fmt.Println(string(out))
        }
        return nil
    }
    if cpuTemp > 40.00 && cpuTemp < 60.01 {
        if !SILENT {
            fmt.Println("CPU Temp is between 40.00°C and 60.00°C")
        }
        out, err := exec.Command("bash", "-c", "liquidctl set pump speed 50 --verbose").Output()
        if err != nil {
            if !SILENT {
                fmt.Println(err)
            }
            return err
        }
        if !SILENT {
            fmt.Println(string(out))
        }
        return nil
    }
    if cpuTemp > 60.00 {
        if !SILENT {
            fmt.Println("CPU Temp is above 60.00°C")
        }
        out, err := exec.Command("bash", "-c", "liquidctl set pump speed 100 --verbose").Output()
        if err != nil {
            if !SILENT {
                fmt.Println(err)
            }
            return err
        }
        if !SILENT {
            fmt.Println(string(out))
        }
        return nil
    }
    return nil
}

func tickerSecond() {
    cpuTemp, err := getCPUTemp()
    if err != nil {
        return
    }
    if !SILENT {
        fmt.Println(cpuTemp)
    }
    err = setPumpSpeed(cpuTemp)
    if err != nil {
        return
    }
}

func setFanCurves() {
    _, err := exec.Command("bash", "-c", "liquidctl set fan speed  20 25  35 25  36 50  45 50  46 100 --verbose").Output()
    if err != nil {
        if !SILENT {
            fmt.Println(err)
        }
        return
    }
}

func setDisplayRotation() {
    _, err := exec.Command("bash", "-c", "liquidctl set lcd screen orientation 90").Output()
    if err != nil {
        if !SILENT {
            fmt.Println(err)
        }
        return
    }
}

func setDisplayBrightness() {
    _, err := exec.Command("bash", "-c", "liquidctl set lcd screen brightness 50").Output()
    if err != nil {
        if !SILENT {
            fmt.Println(err)
        }
        return
    }
}

Depending on your setup / motherboard you need to adjust the sensors/awk cmd to get your actual CPU temp.

Then have it running as systemd service:

[Unit]
Description=krakentempsetter

[Service]
Type=exec
ExecStart=/usr/local/bin/krakentempsetter
#WatchdogSec=30s
Restart=on-failure

[Install]
WantedBy=multi-user.target