@ajgio How are you going to detect intruders? Are you going to look at your cameras yourself and decide? Its better to use Frigate NVR with a Hailo-8 (or OpenVino if your cpu is powerful enough and you only have a couple of cameras). You can do facial recognition in Frigate NVR. More on Frigate NVR here:
Frigate NVR
To answer your question: Yes, you can trigger the siren and lights using Dahua's API via Home Assistant. This will cause the .wav file in the camera that's associated with the siren to play on the camera's speaker. It is about 10 seconds long. If you want it to stop before it finishes playing the entire .wav file, you'll need to use the Dahua API to shut off. Personally, I just let the siren play for 10 seconds. To do this you'll need to use the curl command from the command line in your Home Assistant. You can set it up as a "shell_command" and then use it in a Home Assistant automation.
Here are the commands I use. You'll need to tailor them to your system by replacing your_network_interface, username, password (including the space before "password" below, i.e., username and password separated by : only), camera_ip_address, etc.
Siren on...
curl --digest -g --interface your_network_interface "
: password@camera_ip_address/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=2&info[0].IO=1"
Siren off...
curl --digest -g --interface your_network_interface "
: password@camera_ip_address/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=2&info[0].IO=0"
Lights on...
curl --digest -g --interface your_network_interface "
: password@camera_ip_address/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=1"
Lights off...
curl --digest -g --interface your_network_interface "
: password@camera_ip_address/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=0"
If you have go2rtc installed, you can also stream audio directly from a file in your Home Assistant's /media folder to the camera using something like this:
curl -X POST --interface your_network_interface http://home_assistant_ip_address:1984/api/streams\?dst\=your_camera_name_in_go2rtc\&src\=ffmpeg:/media/audiofile.m4a%23audio\=pcm%23input\=file
You can probably get one of the AI's like Claude or Gemini to help you with this. Good luck. Let us know here how it goes.