A photo of Evan Pratten
Evan Pratten

Making my UDM-Pro scream

Remote fan control for the Unifi Dream Machine Pro

Ubiquiti’s Unifi Dream Machine Pro is a powerful medium-scale business-oriented rack-mount router, capable of handling 10/100/1000/10000 ethernet traffic. Really quite a nice device.

One day, I had the thought: I’ve never heard the fans ramp up on this. And so, I started looking into the possibilities of manual fan control.

As it turns out, this Linux-based device allows you (like any embedded Linux computer) override its I/O with some clever shell commands.

Enter: SSH

If you own a UDM-Pro, you surely know how to log in to it via SSH. If not, look it up 🙂.

With an SSH connection open, the following commands let you control the fans on the device!

# Override the fans with a speed (0-255)
export FAN_SPEED=128
killall -9 S04ubnt-fan-speed ubnt-fan-speed
echo 1 > /sys/class/hwmon/hwmon0/device/pwm1_enable
echo 1 > /sys/class/hwmon/hwmon0/device/pwm2_enable
echo $FAN_SPEED > /sys/class/hwmon/hwmon0/device/pwm1
echo $FAN_SPEED > /sys/class/hwmon/hwmon0/device/pwm2

# Return control back to the device
/etc/init.d/S04ubnt-fan-speed start

Exit stage left

Who needs SSH anyways?

When I discovered this, I decided to write a little program that wraps the SSH commands with a little bit of error checking, and support for auto-discovery of UDM-Pro devices on your network.

https://github.com/ewpratten/udm-fan


The following commands can be used to control the fans on a local UDM-Pro:

# Set the fans to half speed
udm-fan set 128

# Set the fans to full speed (with a custom IP address)
udm-fan set 255 --override-ip 172.16.11.5

# Bring the fans back to automatic control
udm-fan auto

Passwords can be provided through: