Notice that this code requires that the System Preferences Panel be open. (And then it closes it.) This is probably not what you want. But if this is a requirement of the AppleScript, then this is the best KM could do. Since this is ugly, that may be why KM doesn't implement it. Are you satisfied with this code? If you are satisfied, then you can use the code in your own macro to get the job done. You could create a subroutine to implement this. I recommend that if you pass the subroutine a "1" it enables Night Shift, a "0" would disable it, and an empty parameter would toggle it. That's my advice.
Also, I can't test the code because Night Shift works with only five different models of monitor, and I don't have any of them. I've heard from some Youtube channels that Apple may be offering some new models of monitors in two weeks. I might buy one.
As always, there's a 20% chance I'm wrong on anything I say. So take this as a non-authoritative answer.
EDIT: the code for Night Shift, above, may work on an older version of MacOS, not the current version. In any case, it won't make you happy because it requires System Preferences to be open.
Not satisfied with the code, I’ve been aware of the AppleScript you mention for a while (I know google too ). Unfortunately, is slow to start and then also cascades across the UI slow too, or as we both mentioned needs system preference to be open or move through system preferences / doesn’t work with new versions. (i.e. problems)
At the risk of repeating myself this is why I mentioned Shift (which somehow does night shift change gracefully/reliably). Maybe I should have been clearer, since Shift’s code is open source it’s code could be incorporated into KM as a new action.
KM might include open source code, but ONLY if the open-source code doesn't use any undocumented APIs. I spent 5 minutes browsing Shifty files on Github but I was unable to determine (because I'm not smart enough) if it refrained from using undocumented APIs. The method that I demonstrated used visible APIs through AppleScript.
Sorry if I'm repeating myself. Sorry if my response was too elementary for you. I often try to jump in the deep end and try to answer questions that I'm not qualified to answer. Sometimes it works, and sometimes it doesn't.
Did you know that KM doesn't use undocumented APIs?