What is the preferred way to automatically control the ports via software? For my smart home I have a script which restart or powers down services or devices if there is an issue for some time. So I'd also like to switch off the MEGA4 ports and on again after some time.
It seems like the Mega4 web interface works with sockets. So I assume I cannot just power down a port with a simple web request?
Should we just use uhubctl directly?
A web interface would be a nice feature in my case as the restart script runs on another PI.
The web interface for MEGA4 (UWI) is a wrapper of MEGA4's software (written in BASH), and MEGA4's software is a wrapper of uhubctl. So you will eventually call uhubctl.
MEGA4's software is open-sourced, so is UWI.
UWI runs a simple web server, but it doesn't accept your custom web request. You can change that but you will need to work on the source code and make modifications.