I have reviewed this git project and think it's a superior solution. Try it!
This script has been tested on Raspberry Pi OS, Buster (Legacy) and Bullseye only. This installation is simpler that the Waveshare provided instructions.
The supplied program will control the fan but for it to work you must slide the FAN switch on the HAT to the P0 position.
To use the script you can download the zip file and unzip it or, copy and paste the RAW version setup-poe-hat.sh and paste it into an editor. I reccomend you use nano setup-poe-hat.sh
in a Pi terminal or ssh session.
Then run bash setup-poe-hat.sh
When finished it will delete itself and any files needed only for installation. This script can be rerun. It will do a new install of the Waveshare software.
When complete a systemd service named poe-hat.service
will run and start on every boot.
to remove run these commands
sudo systemctl disable poe-hat.service sudo systemctl stop poe-hat.service rm -rf ~/.poe-hat
I don't know what to say. I just built a new pi image and install the latest version of Waveshare following the instructions in this gist (they were changed recently) When I start-up with no ethernet connected it shows the wlan0 IP, when I plug in an ethernet cable it soon switches to eth0 value. when I remove the cable, it then shows the wlan0 again.