I have real-time production/consumption data available via API that I would use as input for controlling the miner's performance. The preferred way would be to directly interact with the miner's API, or even calling a script via SSH that will apply the most appropriate (pre-defined) performance profile. But for this script approach I again don't know if this profile/config change would be applied on the fly or rather only when the bmmminer process gets restarted.
The program has to restart that's for sure, there is probably no way to change those parameters without restarting, so if you plan on changing those constantly your miner will be offline most of the time, but if say this happens once an hour or so - the total downtime won't be huge, and then mining to a PPS pool would be the best approach.
So the biggest question still is, whether such freq/voltage control API commands are available and which makes/models/firmwares (original or custom) do support that. For me this is the most crucial part to clarify before setting this up.
Yes, most of the old stock firmware versions have SSH enabled by default, some of the recent ones can be unclocked, and the latest 1-2 versions are locked and I am not aware of an easy way to unlock them, but you really can work just fine with one of the old firmware versions.
You can find the list here >
https://service.bitmain.com/support/download?product=Antminer%20S9.
Basically, anything prior to any of the 2019 releases is going to have SSH enabled, if so happen that you find it locked you can use this free
tool to unlock it, but by all means, you should avoid the 2020 versions.
You could also use one of
thierry4wd free mods, he basically takes the original firmware and modifies the signature/lock aspect, so you have the same firmware with no locks on it, he also knows a lot about the firmware, so moving forward I believe he will be the best person to ask for support.