Created
August 16, 2025 13:54
-
-
Save luckman212/d0dc2a3fd548b414a2000001eddb6355 to your computer and use it in GitHub Desktop.
ubnt-fanctrl-fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# UBNT fanctrl helper script | |
# ref: https://www.reddit.com/r/Ubiquiti/comments/1fc3uxd/control_the_temperature_of_u7_series_ap/ | |
# adjust 'AP', 'TEMPS' and 'PWM' values below as needed | |
AP=192.168.1.100 | |
ssh \ | |
-oStrictHostKeyChecking=no \ | |
-oUpdateHostKeys=no \ | |
-oLogLevel=error \ | |
-T "$AP" \ | |
sh -s <<'EOF' | |
/bin/fanctrl_wrapper.sh 2>&1 | |
TEMPS='{ "zone3": 60, "wifi0": 70, "wifi1": 65, "wifi2": 70 }' | |
PWM='{ "pwm_min": 50, "pwm_max": 200 }' | |
TMPCONF='/tmp/fanctrl.conf' | |
[ -e $TMPCONF ] && exit 0 | |
. /usr/bin/unifi_util_funcs.sh | |
SYSTEM_ID=$(get_config_value /proc/ubnthal/system.info systemid) | |
REALCONF="/usr/share/fanctrl/ubnt-fanctrl-${SYSTEM_ID}.conf" | |
[ -e "$REALCONF" ] || exit 1 | |
jq --argjson t "$TEMPS" --argjson p "$PWM" >$TMPCONF ' | |
.sensors.zone3.params[0] = $t.zone3 | | |
.sensors.wifi0.params[0] = $t.wifi0 | | |
.sensors.wifi1.params[0] = $t.wifi1 | | |
.sensors.wifi2.params[0] = $t.wifi2 | | |
.fan_settings.pwm_min = $p.pwm_min | | |
.fan_settings.pwm_max = $p.pwm_max' \ | |
"$REALCONF" | |
cp -f $TMPCONF "$REALCONF" | |
pkill -x ubnt-fanctrl | |
EOF |
run this script (cronjob etc) periodically on a host that has connectivity to your AP...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ref: https://www.reddit.com/r/Ubiquiti/comments/1fc3uxd/control_the_temperature_of_u7_series_ap/