Using the Raspberry Pi PoE HAT on my Raspberry Pi 4 I noticed that the fan was too noisy. Here's a way I found to control its speed.
Add to the end of the /boot/config.txt the four temperature thresholds that are necessary to control the fan speed:
$ sudo vi /boot/config.txt # PoE Hat Fan Speed Control dtoverlay=rpi-poe dtparam=poe_fan_temp0=57000 dtparam=poe_fan_temp1=60000 dtparam=poe_fan_temp2=63000 dtparam=poe_fan_temp3=66000
The fan won't turn on until the Raspberry Pi's temperature hits 57°C. The fan speed will increase at 60°C, then again at 63°C, and finally, it will run at full speed at 66°C. These values can be tweaked according to your environment.
Reboot the Raspberry Pi for the changes to take effect:
$ sudo reboot
To check the current temperature on the Raspberry Pi, run the command:
$ vcgencmd measure_temp temp=55.0'C