Hikvision cameras: Trigger audio alarm output possible?

As you can see on the following screenshot, some Hikvision cameras are providing audio alarm output modes. I would love to use these within my Alarmo security installation.
Anyone knows if it is possible somehow to trigger those audio alarm output options from within HA?
I already tried to add the camera as a device via ONVIF integration. It works, but the audio alarm cannot be triggered that way as it is just not available.

Thank you in advance!

2 Likes

Hi, I’m joining you in this thread. I’m interested too in sending trigger alarms to Hikvision cameras.

1 Like

Hello, same here. I am very interested about it. Maybe there is possibility to integrate it to hikvision_next HACKs.

I’m interested to know as well.

You can trigger it like this…

rest_command:
  drive_audio:
    url: "http://CAMERAIPADDRESS/ISAPI/Event/triggers/notifications/AudioAlarm/14/test?format=json"    
    username: ********
    password: ********
    method: put

Make sure you have digest/basic auth setup in System->Security on the camera.

Keiron

Thank you. So this is for triggering the alarm. Do you also know how to stop the alarm after being triggered?

EDIT:
Ok, I got it that this is just for triggering the testalarm which is only being triggering the audio alarm 5 seconds by default. In my case I got it to work with a CURL command because I don’t want to use the basic authentication but only the digest authentication instead (which restful_command does not support, unfortunately) by creating a script with the following command (additionally I want to use https instead of http, just to make sure the traffic is encrypted):

curl -X PUT "https://<myHikvisionCamIPAddress>/ISAPI/Event/triggers/notifications/AudioAlarm/1/test?format=json" --user <myUser>:<myPassword> --insecure --digest

Unfortunately I did not find out (yet) how to trigger the audio alarm without the limitation of only being triggered for five seconds, but I’m on it. If anyone else finds out first, please post it here, thanks!

EDIT 2:
Ok, what I additionally found out is how to trigger the Alarm manually if you have attached an external audio alarm speaker so you can switch it on/off with the integrated relay on the Hikvision camera:

curl -T </path/to/my/file.xml> "https://<myHikvisionCamIPAddress>/ISAPI/System/IO/outputs/1/trigger" --user <myUser>:<myPassword> --insecure --digest

Where the content of the according XML files look like this:

Turn on alarm:

<IOPortData version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<outputState>high</outputState>
</IOPortData>

Turn off alarm:

<IOPortData version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<outputState>low</outputState>
</IOPortData>

Yes, I’m aware this is not the solution to trigger audio alarm signal of the internal Hikvision speaker, but maybe it helps someone with an external speaker attached. Still looking for a solution to trigger the internal speaker for more than 5 seconds though :wink:

EDIT 3:
Ok, I think there is no way to trigger the internal Hikvision audio alarm speaker manually, apart from the audio test alarm which is limited to only 5 seconds. Simply because there is no way to trigger the alarm via web interface and I also checked the capabilities according to the Hikvision manual which led me to the following commands:

curl -X GET "https://<myHikvisionCamIPAddress>/ISAPI/System/IO/outputs/capabilities" --user <myUser>:<myPassword> --insecure --digest

and

curl -X GET "https://<myHikvisionCamIPAddress>/ISAPI/Event/triggers/notifications/AudioAlarm/capabilities?format=json" --user <myUser>:<myPassword> --insecure --digest

but none of them gave me very promising capabilities according to manual audio alarm triggers. Only the capabilities that are available via the Web GUI were being listed, obviously.

As a workaround you could just repeat the trigger via HA script every 5 seconds as long as you need the audio alarm being triggered.

If someone finds out better, please post it here. Maybe also someone wants to place a feature request on Hikvision itself? I would definitely follow :wink:

Hi,

First thank you for this post. It was very useful for me to explore a way to trigger my camera alarm sound output and strobe light.

I found a way to do it on my camera messing with the alarm type of the Alarm Inputs:
https:///ISAPI/System/IO/inputs/1

If you change Alarm type to NC it will trigger the alarm and the strobe light until you change it again to NO.

payload in xml to enable the alarm and strobe:

'<IOPortData>
<enabled>true</enabled>
<triggering>low</triggering>
</IOPortData>'

payload in xml to disable the alarm and strobe:

'<IOPortData>
<enabled>false</enabled>
<triggering>high</triggering>
</IOPortData>'

Don’t forget in the linkage method to enable the flashing alarm and audible warning and the trigger alarm output A->1

Thanks a bunch @SoulSlayer

I was finally able to trigger the alarm as with your solution.
I just want to mention here that it is also poosible to send the according XML values inline within a single command as follows instead of using an external XML file, which seems more accurate to me as as I’m not sure where the best place would be on the HA filesystem to store an XML file permanently without losing it (when for example migrating the HA instance to antoher system architecture):

shell_command:
  # Turn on alarm:
  alarm_turn_on_command: "curl -X PUT -H 'Content-Type: application/xml' -d '<xml><IOPortData><enabled>true</enabled><triggering>low</triggering></IOPortData></xml>' https://<myHikvisionCamIPAddress>/ISAPI/System/IO/inputs/1 --user <myUser>:<myPassword> --insecure --digest"
  # Turn off alarm:
  alarm_turn_off_command: "curl -X PUT -H 'Content-Type: application/xml' -d '<xml><IOPortData><enabled>false</enabled><triggering>high</triggering></IOPortData></xml>' https://<myHikvisionCamIPAddress>/ISAPI/System/IO/inputs/1 --user <myUser>:<myPassword> --insecure --digest"

Just copy+paste the command above into your configuration.yaml file, adjust the according placeholders to your requirements, save the file, reboot HA and you’re ready to go!