百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

fan2go

> 编程语言
开源

一个简单的守护进程,基于温度传感器提供动态风扇速度控制。

359 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个简单的守护进程,基于温度传感器提供动态风扇速度控制。

fan2go

A daemon to control the fans of your computer.

Features

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

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

bash
yay -S fan2go-git

Community Maintained Packages

Nix OS

  • Nix with Flakes:
bash
nix profile install nixpkgs#fan2go
  • Nix stable:
bash
nix-env -f '' -iA fan2go

Debian / Ubuntu

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

Manual

Download the latest release from GitHub:

bash
# 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:

bash
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
bash
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:

…

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:

…

NVIDIA

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

yaml
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

yaml
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
bash
> 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.

yaml
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.

yaml
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:

…

Sensors

Under sensors: you need to define a list of temperature sensor devices that you want to monitor and use to adjust fanspeeds. Like with fans, you can find usable devices using fan2go detect.

HwMon

yaml
# A list of sensors to monitor
sensors:
  # A user defined ID, which is used to reference
  # a sensor in a curve configuration (see below)
  - id: cpu_package
    # The type of sensor configuration, one of: hwmon | nvidia | file | cmd | disk
    hwmon:
      # A regex matching a controller platform displayed by `fan2go detect`, f.ex.:
      # "coretemp", "it8620", "corsaircpro-*" etc.
      platform: coretemp
      # The index of this sensor as displayed by `fan2go detect`
      index: 1

NVIDIA

yaml
sensors:
  - id: gpu_temp
    nvidia:
      # A regex matching a nvidia device as displayed by `fan2go detect`
      device: nvidia-10DE2489-0800
      # The index of this sensor as displayed by `fan2go detect`
      # (currently NVIDIA/nvml exposes only a single temperature sensor per GPU)
      index: 1

File

yaml
sensors:
  - id: file_sensor
    file:
      # Path to the file containing sensor values
      path: /tmp/file_sensor

The file contains a value in milli-units, like f.ex. milli-degrees.

bash
> cat /tmp/file_sensor
10000

CMD

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

Just like the file sensor, the command must output the sensor value in milli-units, like f.ex. milli-degrees.

yaml
sensors:
  - id: cmd_fan
    cmd:
      # Path to the executable to run to retrieve the current sensor value
      exec: /usr/bin/bash
      # (optional) arguments to pass to the executable
      args: [ '/home/markus/myscript.sh' ]

Curves

Under curves: you need to define a list of fan speed curves, which represent the speed of a fan based on one or more temperature sensors.

Speed values: Curve values range from 0 to 255 (equivalently 0% to 100%). By default, fan2go scales these to the fan's detected (or configured) minPwm..maxPwm range:

  • 0 / 0% → fan off (unless neverStop: true, in which case the fan is held at minPwm)
  • 1..255 / 1%..100% → linearly mapped to minPwm..maxPwm

To use curve values as raw PWM values without scaling, set useUnscaledCurveValues: true in the fan config.

Linear

To create a linear speed curve, use a curve of type linear.

This curve type can be used with a min/max sensor value, where the min temp will result in a curve value of 0 and the max temp will result in a curve value of 255:

yaml
curves:
  - id: cpu_curve
    # The type of the curve, one of: linear | function
    linear:
      # The sensor ID to use as a temperature input
      sensor: cpu_package
      # Sensor input value (in degrees Celsius)
      # at which the curve is at minimum speed
      min: 40
      # Sensor input value at which the curve is at maximum speed
      max: 80

You can also define the curve in multiple, linear sections using the steps parameter, where the left side refers to the sensor input value and the right side refers to the curve value at that sensor input.

…

NOTE: When using useUnscaledCurveValues in the fan configuration, the values specified in the curve are **not scaled ** to the [MinPwm..MaxPwm] range of the fan, but are directly mapped with the pwmMap (if specified) or used as is (if no pwmMap is specified and a 1:1 mapping is assumed). In this case, it is recommended to specify curve values in the same range as the expected PWM values after scaling to avoid confusion. So if your fan has a MinPwm of 30 and a MaxPwm of 255, you should specify curve values in the [30..255] range.

Alternatively the speeds can be specified in [0..255] range:

yaml
curves:
  - id: cpu_curve
    # The type of the curve
    linear:
      # The sensor ID to use as a temperature input
      sensor: cpu_package
      # Steps to define a section-wise defined speed curve function.
      steps:
        # Sensor value (in degrees Celsius) -> Speed (0-255)
        - 40: 0
        - 41: 1
        - 50: 50
        - 80: 255

Staircase

To create a staircase speed curve, use a curve of type staircase.

It maintains static fan speeds at defined temperature ranges. This prevents fans from constantly ramping up and down (oscillating) in response to minor, rapid fluctuations in sensor temperature, offering a more consistent acoustic profile.

yaml
curves:
  - id: staircase_curve
    staircase:
      sensor: cpu_package
      hysteresis:
        down: 6
      steps:
        # Sensor value (in degrees Celsius) -> Speed (0-255)
        - 40: 1
        - 50: 50
        - 80: 255

PID

If you want to get your hands dirty and use a PID based curve, you can use pid:

yaml
curves:
  - id: pid_curve
    pid:
      sensor: cpu_package
      setPoint: 60
      p: -0.05
      i: -0.005
      d: -0.005

Unlike the other curve types, this one does not use the average of the sensor da

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Godaemonfanfan-speedfancontrol

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言