Dahua API and active deterrence?

Cold-Lemonade

Pulling my weight
Apr 1, 2021
179
139
Boston
I have a Dahua TiOC (IPC-T5241H-AS-PV). Does anyone know the Dahua API command to select the audio file (among the pre-installed files) to play when the camera's alarm is triggered? For example, it would be nice to be able play the siren wav file, then play the wav file saying "You are trespassing". But the way the camera is set up, it can only play one file at a time. So I need to issue a command to the API to select a different file to do this.

Any insight?
 
Reading through API document v3.18 I cannot see anything towards the TiOC series...?
Audio status and volume is an option but doesn't seem to mention how to play a specific audio file.
Nor does it mention how to activate the blue/red lights (but it mentions 'non-smart' while lights).

For example, it would be nice to be able play the siren wav file, then play the wav file saying "You are trespassing". But the way the camera is set up, it can only play one file at a time. So I need to issue a command to the API to select a different file to do this.
I would just download both audio files and make them into one audio file with Audacity.
You may need an SD card inside of the camera to upload audio files to.


Here is a good video; Montavue camera's are rebranded Dahua cameras.


and some inspiration for audio clips:
 
Thank you @Mark_M

I think what I'll need to do install go2rtc in Home Assistant OS. go2rtc will let me stream any file I want from my raspberry pi to my cameras.
I saw this last night.... looks like the API can do the light/speaker on TiOC cameras.

I haven't tested it yet, but this does the first audio file on the camera.
http://username:password@camera_ip_address/cgi-bin/coaxialControlIO.cgi?action=control&channel=2&info[0].Type=2&info[0].IO=1
 
  • Like
Reactions: fenderman
I saw this last night.... looks like the API can do the light/speaker on TiOC cameras.

I haven't tested it yet, but this does the first audio file on the camera.
http://username:password@camera_ip_address/cgi-bin/coaxialControlIO.cgi?action=control&channel=2&info[0].Type=2&info[0].IO=1
Holly F.
I just did that command and can't get the siren to turn off :rofl::lmao:.
 
@Mark_M Yes--That is from one of my earlier posts. That command will trigger the audio file that has been manually selected in the camera through its web interface. What I would like to do is change the audio file by issuing an API command at the command line in linux.
 
Change the last part to =0 and do it again, It will turn off.
I'm doing this on a thermal Dahua camera...
IO=2 seems to be off.
Not off = 0 & on = 1.
On: http://192.168.1.23/cgi-bin/coaxialControlIO.cgi?action=control&channel=2&info[0].Type=2&info[0].IO=1
Off: http://192.168.1.23/cgi-bin/coaxialControlIO.cgi?action=control&channel=2&info[0].Type=2&info[0].IO=2

White light with 'Type=1' returns a bad request error. (Even though API 3.18 says 1 is white light and 2 is siren..??)
 
I'm doing this on a thermal Dahua camera...
IO=2 seems to be off.
Not off = 0 & on = 1.
On: http://192.168.1.23/cgi-bin/coaxialControlIO.cgi?action=control&channel=2&info[0].Type=2&info[0].IO=1
Off: http://192.168.1.23/cgi-bin/coaxialControlIO.cgi?action=control&channel=2&info[0].Type=2&info[0].IO=2

White light with 'Type=1' returns a bad request error. (Even though API 3.18 says 1 is white light and 2 is siren..??)

I'm glad you got it turned off.
 
Reading through API document v3.18 I cannot see anything towards the TiOC series...?
Audio status and volume is an option but doesn't seem to mention how to play a specific audio file.
Nor does it mention how to activate the blue/red lights (but it mentions 'non-smart' while lights).


I would just download both audio files and make them into one audio file with Audacity.
You may need an SD card inside of the camera to upload audio files to.


Here is a good video; Montavue camera's are rebranded Dahua cameras.


and some inspiration for audio clips:


please share API document v3.18 ?
 
If your camera can play custom audio files, one way around this would be to create your own custom audio file of the siren followed by the message. That way you only have 1 file for the camera to play. An App like Audacity might enable you to create this. I'm unsure off the top what format Dahua cameras use / require for audio.
 
Good link but why don't they just say somewhere to output .wav fomat at 32000kbs sample rate? Personally I'd rather use an App I know such as Audacity as it has far more audio adjustment possibilities beyond pure conversion.
 
Last edited:
  • Like
Reactions: Grn1z
Hi rather than starting a new thread, figured id ask here due to similar topic.


I’m trying to use a Philips Hue smart button as a simple, physical trigger to control the active deterrence features (flashing lights and siren/audio) on Dahua TiOC cameras.

The idea is:

Press the Hue button, immediately activate the TiOC flashing lights and siren
Press again, stop the siren immediately.

The main goal is to avoid Dahua’s built-in alarm timers, where once triggered, the siren run for a fixed duration and can’t be cancelled early. Instead, I want it to behave more like a controllable output (on/off), similar to a relay.

Initially, I looked at using a Zigbee relay (paired with Hue via home assist) to trigger an alarm input on the NVR, which would then link to the camera deterrence outputs. While that approach is reliable, it’s still event/timer-based on the Dahua side and doesn’t allow immediate cancellation once triggered.

Because of that, I’m now looking at using the Dahua API instead, so I can send explicit ON and OFF commands to the camera and have full control over when the deterrence starts and stops and bypass the physical relay idea.

In parallel, I’ll still have a normal IVS detection rule running on the cameras for flashing lights as a visual deterrent.

However, I only want the siren to be triggered manually when I’ve confirmed an intruder, which is why I want to use the Hue button as a deliberate trigger.

Since the Hue system can’t send API commands directly, I’m planning to use a small controller layer (e.g. Home Assistant) to listen for the Hue button press and then send the appropriate API calls to the camera

Is this idea possible? Would home assist be the best way to implement between hue ecosystem and dahua eco system and is dahua API the best way togo here?

Any advise appreciated.
 
@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.
 
I have a Dahua TiOC (IPC-T5241H-AS-PV). Does anyone know the Dahua API command to select the audio file (among the pre-installed files) to play when the camera's alarm is triggered? For example, it would be nice to be able play the siren wav file, then play the wav file saying "You are trespassing". But the way the camera is set up, it can only play one file at a time. So I need to issue a command to the API to select a different file to do this.

Any insight?
The coaxialControlIO.cgi command seems only play whatever file you've already selected in the web UI — no way to pick a specific file via API.
Apparently API v3.24 added this feature, but good luck finding that doc — it's under NDA.
Easiest fix: just merge your siren + voice warning into one file with Audacity, convert to PCM, upload it. Done.
Or if you're on Home Assistant, go2rtc can push any audio to the camera speaker over RTSP — way more flexible.
 
@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.

Thanks for the reply.

The idea I’ve got in mind is to set up a two-stage deterrence system using the TiOC cameras and a Hue smart button.

First stage is automatic using IVS. I’d have tripwire or intrusion detection active so that when triggered it sends the normal AI alerts to my phone via DMSS, while also flashing the red/blue lights on the camera and playing a voice message like “you are under surveillance”. That gives a visible and audible deterrent straight away without needing to manually trigger anything.


Then the second stage is manual escalation. If I actually see something and want to step things up, I press a Hue smart button. That would turn on all my external lights via the Hue ecosystem, and at the same time Home Assistant would pick up that button press and send API commands to all the TiOC cameras to activate the siren (alarm sound) and their deterrence lighting.

So basically:

IVS handles automatic alerts + initial deterrence (lights + voice)

Hue button is used for deliberate escalation to full alarm (siren + lights)

The main goal is to avoid having the siren going off automatically all the time, but still have the ability to instantly trigger it when needed.