It can be done with this utility if the GUI is the old black/grey/orange GUI.
If not, then further on that post are how to put in the APIs in BI are in there.
While varifocals are designed as a set and forget, many of us have had a varifocal change once or twice per day based on day/night and work fine. Mine is still going strong since 2019. The only exception is the focus has drifted over time, probably because of this daily zoom, but a simple "recalibrate" it to a new focus number fixed that, but I have only had to do that once.
I wanted to use stronger noise reduction at night and weaker during the day, but Dahua seems to have made a mess of the profile management. On most cameras, there doesn't seem to be a way to have the camera switch automatically between Day and Night profiles when the camera changes between...
ipcamtalk.com