I recently purchased a Unifi Cloud Gateway Max for my homelab, and let me tell you, it’s a beast!
HOWEVER, this thing also runs terribly 🔥HOT🔥 – even with just the Network application installed (I am currently not running Protect, Access, etc.)
I don’t know if it’s a bug and if it will eventually get fixed with a future firmware upgrade, but as of version 4.1.13
the problem is still there.
Fortunately, there is an easy fix.
Checking the UCG Max’s Temperature
There are 2 ways to check the temperature:
- Via the Unifi UI
- Via the Unifi CLI
Unifi UI:
Browse to your Unifi web URL (ie. https://192.168.1.1
or whatever DNS name you may have assigned) and then browse to **Control Plane > Console > About this Console**.
Unifi CLI:
SSH into your UCG and issue `ubnt-systool cputemp`
root@Cloud-Gateway-Max:~# ubnt-systool cputemp
79.9
Now, I’m no expert but at ~80°C one would think the fan should get to work. However, this was not the case:
root@Cloud-Gateway-Max:~# sensors
lm63-i2c-2-4c
Adapter: i2c-0-mux (chan_id 1)
fan1: 0 RPM (min = 0 RPM)
temp1: +62.0°C (high = +70.0°C)
temp2: +69.5°C (low = +0.0°C, high = +70.0°C)
(crit = +125.0°C, hyst = +115.0°C)
0 RPM!
I could not readily find what temp1
and temp2
map to and don’t know at which threshold the fan should (have) kick(ed) in. But with the cputemp
metric reading 80, the fan should definitely be spinning!
Looking for a FIX
Fortunately it didn’t take long to stumble on the following thread:
Interestingly, there is a way to manually control the fan by defining a value ranging from 0 to 255 under the hardware monitoring (hwmon
) subsystem:
cd /sys/class/hwmon/hwmon0
echo <value> > pwm1
According to various users affected by this issue, setting this to a value of 50, 100, 200 would force the fan to start and cool down the system. See this thread, for example.
With my fan at 0 RPM, I issued the following commands to check my UCG’s current setting:
cd /sys/class/hwmon/hwmon0
cat pwm1
And my result was …. 0
!
I tried various values, and sure enough, the fan started spinning. This immediately brought my UCG’s temperature down and I was happy.
But I was not convinced that this was a permanent solution – Would I need to set this back to 0
? Would I need to constantly be on the lookout and modify these values every time the temperature spiked?
Enter ucg-max-fan-control ❤️
Temperature-based Fan Control Solution for Ubiquiti UCG-Max
I found this awesome repo which – to quote the creator – will create a service on the UCG which will:
- Maintain base fan speed (PWM 91) below 60°C
- Ramp up linearly from 91-255 PWM between 60-85°C
- Apply maximum cooling (255 PWM) above 85°C
- Check temperature every 15 seconds
The project is simple and very well documented:
Install the service on your UCG:
root@Cloud-Gateway-Max:/sys/class/hwmon/hwmon0# curl -sSL https://raw.githubusercontent.com/iceteaSA/ucg-max-fan-control/main/install.sh | sh
Created symlink /etc/systemd/system/multi-user.target.wants/fan-control.service → /etc/systemd/system/fan-control.service.
Installation complete. Fan control service is now active.
Uninstall script: /data/fan-control/uninstall.sh
If you need to change the values, just edit the `/data/fan-control/fan-control.sh` script to reflect your preferences:
BASE_PWM=91 # Quiet operation speed (0-255)
MIN_TEMP=60 # Start ramping up from this temp (°C)
MAX_TEMP=85 # Full speed temperature (°C)
CHECK_INTERVAL=15 # Seconds between checks
And reload with
systemctl restart fan-control.service
Sure enough, in the span of 15 minutes after running the service, my temps dropped from 80 to 58 degrees!
Thank you iceteaSA!
Until Ubiquiti addresses this issue, I will surely be running this service on my UCG Max. And when I am conviced that the issue if fixed, I will uninstall the fan control service as documented with /data/fan-control/uninstall.sh
.