Making my UDM-Pro scream
/* Remote fan control for the Unifi Dream Machine Pro */
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.
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.
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:
.netrcentry with the hostname being the UDM's IP address
- The terminal at runtime