SkillAgentSearch skills...

Fan2go

A simple daemon providing dynamic fan speed control based on temperature sensors.

Install / Use

/learn @markusressel/Fan2go
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<h1 align="center"> <img src="screenshots/fan2go_icon.svg" width="144" height="144" alt="fan2go icon"> <br> fan2go <br> </h1> <h4 align="center">A daemon to control the fans of your computer.</h4> <div align="center">

Programming Language Latest Release License

</div> <p align="center"><img src="screenshots/graph.png" width=90% alt="Screenshot of Pyrra"></p>

Features

  • [x] Intuitive YAML based configuration
  • [x] Massive range of supported devices
    • [x] lm-sensors (hwmon) based sensors and fans
    • [x] Fans and temperature sensor on NVIDIA GPUs (nvml)
    • [x] File based fan/sensor for control/measurement of custom devices
    • [x] Command based fan/sensor
  • [x] Per fan user-defined speed curves
  • [x] Fully customizable and composable curve definitions
  • [x] Works after resume from suspend
  • [x] Stable device paths after reboot
  • [x] Automatic analysis of fan properties, like:
    • [x] RPM curve
    • [x] minimum and maximum PWM
  • [x] Error notifications
  • [x] Prometheus exporter
  • [x] (optional) REST Api

UI

fan2go is first and foremost a daemon that runs in the background. However, it also provides a small set of CLI commands (see CLI Commands) as well as an optional local HTTP API to allow external programs to interact with it. This API can be used to create UI clients or other tools.

UI Clients

fan2go-tui - (Official) Terminal UI for fan2go.

asciicast

How to use

fan2go relies on lm-sensors to get both temperature and RPM sensor readings, as well as PWM controls, so you will have to set it up first.

Installation

Arch Linux

yay -S fan2go-git
<details> <summary>Community Maintained Packages</summary>

Nix OS

nix profile install nixpkgs#fan2go
  • Nix stable:
nix-env -f '<nixpkgs>' -iA fan2go

Debian / Ubuntu

See: https://github.com/johnwbyrd/fan2go-package/

</details>

Manual

Download the latest release from GitHub:

# Install dependencies
sudo pacman -S libnotify

curl -L -o fan2go https://github.com/markusressel/fan2go/releases/latest/download/fan2go-linux-amd64
chmod +x fan2go
sudo cp ./fan2go /usr/bin/fan2go
fan2go -h

Or compile yourself:

git clone https://github.com/markusressel/fan2go.git
cd fan2go
make build
sudo cp ./bin/fan2go /usr/bin/fan2go
sudo chmod ug+x /usr/bin/fan2go

Configuration

Then configure fan2go by creating a YAML configuration file in one of the following locations:

  • /etc/fan2go/fan2go.yaml (recommended)
  • /root/.fan2go/fan2go.yaml
  • ./fan2go.yaml
sudo mkdir /etc/fan2go
sudo nano /etc/fan2go/fan2go.yaml

The most important configuration options you need to define are the fans:, sensors: and curves: sections.

Fans

Under fans: you need to define a list of fan devices that you want to control using fan2go. To detect fans on your system run fan2go detect, which will print a list of devices exposed by the hwmon filesystem backend:

$ fan2go detect
=========== hwmon: ============

> Platform: nct6798-isa-0290
 Fans     Index  Channel  Label        RPM   PWM  Mode
          1      1        hwmon4/fan1  0     153  Manual
          2      2        hwmon4/fan2  1223  104  Manual
          3      3        hwmon4/fan3  677   107  Manual
 Sensors   Index   Label    Value
           1       SYSTIN   41000
           2       CPUTIN   64000

> Platform: amdgpu-pci-0031
 Fans     Index  Channel  Label        RPM   PWM  Mode
          1      1        hwmon8/fan1  561   43   Manual
 Sensors   Index   Label      Value
           1       edge       58000
           2       junction   61000
           3       mem        56000

=========== nvidia: ===========

> Device: nvidia-10DE2489-0800
  Fans     Index  Label  PWM  RPM   Mode
           1      Fan 1  36   1300  Auto
           2      Fan 2  36   1298  Auto
  Sensors  Index  Label        Value
           1      Temperature  59000

The hwmon fan index is based on device enumeration and is not stable for a given fan if hardware configuration changes. The Linux kernel hwmon channel is a better identifier for configuration as it is largely based on the fan headers in use.

Fan RPM, PWM, and temperature sensors are independent and Linux does not associate them automatically. A given PWM may control more than one fan, and a fan may not be under the control of a PWM. By default, fan2go guesses and sets the pwm channel number for a given fan to the fan's RPM sensor channel. You can override this in the config.

For nvidia devices, the fan index is stable.

Note that it can happen that the hardware only gives limited control over a fan and it, for example, always runs with at least 30% speed - even if in automatic mode the hardware may make it stop entirely if the temperature is low enough.

HwMon

To use detected hwmon devices in your configuration, use the hwmon fan type:

# A list of fans to control
fans:
  # A user defined ID.
  # Used for logging only
  - id: cpu
    # The type of fan configuration, one of: hwmon | file
    hwmon:
      # A regex matching a controller platform displayed by `fan2go detect`, f.ex.:
      # "nouveau", "coretemp", "it8620", "corsaircpro-.*" etc.
      platform: nct6798
      # The channel of this fan's RPM sensor as displayed by `fan2go detect`
      rpmChannel: 1
      # The pwm channel that controls this fan; fan2go defaults to same channel number as fan RPM
      pwmChannel: 1
    # Indicates whether this fan should never stop rotating, regardless of
    # how low the curve value is
    neverStop: true
    # The curve ID that should be used to determine the
    # speed of this fan
    curve: cpu_curve

NVIDIA

To use detected NVIDIA GPUs in your configuration, use the nvidia fan type:

fans:
  - id: gpufan1
    nvidia:
      # A regex matching a nvidia device as displayed by `fan2go detect`
      # the following matches all nvidia devices in your system
      # (good enough if you only have one), otherwise you could
      # also use nvidia-10DE2489-0800 or similar
      device: nvidia
      # The fan's index as shown by `fan2go detect`
      index: 1
    curve: gpu_curve

  # same for the second fan
  - id: gpufan2
    nvidia:
      device: nvidia
      index: 2
    curve: gpu_curve

Note that the fan speed can only be controlled for GPUs of the "Maxwell" generation (Geforce 9xx) and newer, and that reading the fan speed in RPM requires nvidia driver 565 or newer.

File

fans:
  - id: file_fan
    file:
      # Path to a file to get/set the PWM target for this fan
      path: /tmp/file_fan
      # Path to a file to read the current RPM value of this fan
      rpmPath: /tmp/file_fan_rpm
> cat /tmp/file_fan
255
> cat /tmp/file_fan_rpm
3421

CMD

Please also make sure to read the section about considerations for using the cmd sensor/fan.

fans:
  - id: cmd_fan
    cmd:
      # Command to apply a new PWM value (0..255)
      # Use "%pwm%" to specify where the target pwm value should be used within the arguments
      setPwm:
        exec: /usr/bin/some-program
        args: [ "--set", "%pwm%" ]
      # Command to retrieve the current PWM value (0..255)
      getPwm:
        exec: /usr/bin/nvidia-settings
        args: [ "-a", "someargument" ]
      # (optional) Command to retrieve the current RPM value
      getRpm:
        exec: /usr/bin/nvidia-settings
        args: [ "-a", "someargument" ]

Disk

Reads the temperature of a block device (SATA, NVMe, etc.) using a stable device path instead of an hwmon platform index that can change across reboots.

sensors:
  - id: ssd_temp
    disk:
      # Full path (recommended for clarity)
      device: /dev/disk/by-id/ata-Samsung_SSD_870_EVO_1TB_S1234567890
      # Short form also accepted (prefix /dev/disk/by-id/ is auto-applied):
      # device: ata-Samsung_SSD_870_EVO_1TB_S1234567890
      # The /dev/ prefix is also optional (e.g. just "sda"):
      # device: sda

  - id: nvme_temp
    disk:
      device: /dev/disk/by-id/nvme-Samsung_SSD_980_1TB_S1234567890
      # Short form: device: nvme-Samsung_SSD_980_1TB_S1234567890

Requires the drivetemp kernel module for SATA drives (standard since kernel 5.6) or nvme-hwmon for NVMe (standard since kernel 4.15). Falls back to a direct ATA SMART ioctl for SATA drives without drivetemp loaded.

Advanced Options

If the automatic fan curve analysis doesn't provide a good enough estimation for how the fan behaves, you can use the following configuration options (per fan definition) to correct it:

fans:
  - id: ...
    ...
    # (Optional) Override for the lowest PWM value at which the
    # fan is able to maintain rotation if it was spinning previously.
    minPwm: 30
    # (Optional) Override for the lowest PWM value at which the
    # fan will still be able to start rotating.
    # Note: Settings this to a value that is too small
    #       may damage your fans. Use at your own risk!
    startPwm: 30
    # (Optional) Override for the highest PWM value which still yields
    # an increased rotational speed compared to lower val

Related Skills

View on GitHub
GitHub Stars332
CategoryDevelopment
Updated22h ago
Forks29

Languages

Go

Security Score

100/100

Audited on Mar 31, 2026

No findings