@wittaj do you use Home Assistant? I'm curious how your use of BI compares to my Home Assistant setup? Dahua cameras + Home Assistant + Deepstack seems to be the sweet spot for me. It gives me the ability to totally integrate any and everything. As an example, at night, if a human is detected by my cams, all my outside lights turn on for 5 minutes. I only record on motion to my NAS so in general, I don't have a central server processing all the video feed 24/7.
Nope I do not run HA (yet anyway lol)
I have found that BI with Dahua camera AI is my sweet spot. I have the Dahua AI IVS rule configured for triggering within my "personal space" around the home and that is what sends me push and alerts. Then I let BI motion take care of any other motion outside of those areas.
It has been on my list of things to do to figure out the API to arm/disarm active deterrence and then set up a profile to disarm them. Hopefully the API script you have above work for mine as I have found little nuance differences in APIs among different Dahua cams.