Hikvision - SDK trigger manual recording form HA Switch

Hi

Been looking at the hikvision SDK and current Hik HA components. There is a component to enable or disable motion detection.

Is there a possible way of triggering manual recording on Hik NVR? I have 3 cams connected to the NVR and would like to be able to trigger start/stop recording of all cameras.

Looking at the SDK its sort of all rolled into one for NVR/Cams encoders etc.

Hope someone can help, i’ve looked at the github for the component, but cant seem to find how to contact the creator maybe @arsaboo might be able to assist.

Thanks

Are you able to list which cams and NVR you have?
With regards to the author, @mezz64 is your man

Thanks for info,
I have the following

In my luton style campervan
Hikvision DS-7604NI-P
2x DS-2CD2535FWD-IS-2.8MM - Side cameras
1x DS-2CD2323G0-I-2.8MM - Rear
1x Vivotek CC8370-HV 180deg panaromic - forward facing, to record our trips.
I have HA in the van which is why i need the start stop trigger, going on a month european trip and to conserve HDD space, i will only want to record at certain times.

At Home.
Hikvision DS7608xxxxx (older model)
Various cameras, axis hikvision etc

I’m the author of the binary sensor component that lets you pull events from cameras/nvrs into home assistant, but not the switch component that @frank451 is referring to. Original plan was to roll everything into one, but I never got around to it.

That being said, I don’t believe there is an API command to trigger recording. I know others have made a workaround using a unused IO port (If you camera/nvr supports IO) wired back into the camera since you can trigger an IO port through the API.

thanks @mezz64, just PM’d you :slight_smile:

my model doesnt have hardwired inputs and outputs unfortuantly, and probably would have been a more simple way.

There SDK supports manual record trigger, but not sure about the API, would it maybe just be a case of changing the motion switch code to the trigger code if its available?

CCTV is my day to day job (Technical Manager) but im no programmer yet !!

Thanks

There isn’t a documented API command, if there were you could likely modify the motion switch code without much trouble.

I see that you can indeed do it through the SDK. I’ll make a note to look into it in the future when I have some time. I know it’s been requested before and it would be a nice feature to have.

1 Like

Not tested, but maybe this will help?

http://down.dipol.com.pl/Cctv/-Hikvision-/isapi/HIKVISION%20ISAPI_2.0-RaCM%20Service.pdf

7.4.1 /ISAPI/ContentMgmt/record/control/manual/start/tracks/
This resource is used to manually Start the recording track, regardless of recording mode.
To Enable or Disable (i.e. permanent Stop) the track, the configuration interface should be used to update the track configuration object to set the enable/disable value accordingly.

7.4.2 /ISAPI/ContentMgmt/record/control/manual/stop/tracks/

Interesting. So could possibly do it via command line??

Any help would be appreciated

Yes, just checked:

curl -X PUT “http://user:[email protected]:80/ISAPI/ContentMgmt/record/control/manual/start/track/101
– starts recording channel 1 stream 1 (main stream)

Response:

<?xml version="1.0" encoding="UTF-8" ?>
<ResponseStatus version="1.0" xmlns="urn:psialliance-org">
<requestURL>/ISAPI/ContentMgmt/record/control/manual/start/track/101</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus> 

curl -X PUT “http://user:[email protected]:80/ISAPI/ContentMgmt/record/control/manual/stop/track/101
– for stop

Response:

<?xml version="1.0" encoding="UTF-8" ?>
<ResponseStatus version="1.0" xmlns="urn:psialliance-org">
<requestURL>/ISAPI/ContentMgmt/record/control/manual/stop/track/101</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>    

201 - for main stream Channel 2
301 - etc…

UPD: tested on HiWatch(HikVision) DVR DS-H204Q

Show all tracks: “/ISAPI/ContentMgmt/record/tracks”

Sweet :+1:. I will have a play with that, never used curl in ha. Is it just command line with on off, and I presume it will reflect it’s real time status with switch position, being different commands?

I’ll feed back on my ds6704(current model) fw latest. and ds6708(older model) fw 5.xx

Thanks

This only works on NVR/DVR devices unfortunately. Pretty sure the only way to manually trigger a camera to record is through the Hikvision SDK. I did play around some with capturing the packets when issuing the commands through the device management port, but didn’t get anywhere decoding the data packets.

No that’s fine, I will be triggering the channels on the nvr to start recording.

Not had a chance to look into trying it yet though.

Thanks for your assistance.