Setup Hikvision camera in OH2

  • Platform information:
    • Hardware: RP3
    • OS: Debian8
    • Java Runtime Environment:
    • openHAB version: latest

Hi there
I have a new Hikvision camera and looking how to ativate/desactivate motion detection and seen pictures when alarm is given.
Has somebody somethinks like this?

Best regards
Ossy

You can try ZoneMinder:
https://docs.openhab.org/addons/bindings/zoneminder/readme.html

Or there is an API to the cameras.
I use rules to enable WDR during the day

rule "Cam 1 WDR Switch"

	when Item CAM1_WDR_Switch changed

    then

    if ( CAM1_WDR_Switch.state == ON ) {
    	    executeCommandLine("curl@@-T@@/home/sj/bin/hik_wdr_on.xml@@http://admin:password@172.29.56.44/ISAPI/Image/channels/1/WDR") }
    if ( CAM1_WDR_Switch.state == OFF ) {
    	    executeCommandLine("curl@@-T@@/home/sj/bin/hik_wdr_off.xml@@http://admin:password@172.29.56.44/ISAPI/Image/channels/1/WDR") }

end

/home/sj/bin/hik_wdr_on.xml:

<?xml version="1.0" encoding="UTF-8"?>
<WDR version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<mode>open</mode>
<WDRLevel>50</WDRLevel>
</WDR>

Hope it will guide you to the right direction.

This is what I use
I have a switch called Motion_Pool_Enabled
and a rule

rule "Pool Motion Enable"
when
Item Motion_Pool_Enabled received command
then
	var String Response = sendHttpGetRequest("http://admin:secret@192.168.192.85/ISAPI/System/IO/inputs/1")
	if (Motion_Pool_Enabled.state == ON){
		Response = Response.replace("<enabled>false</enabled>","<enabled>true</enabled>")
		sendHttpPutRequest("http://admin:secret@192.168.192.85/ISAPI/System/IO/inputs/1","application/x-www-form-urlencoded; charset=UTF-8",Response)
	} else {
		Response = Response.replace("<enabled>true</enabled>","<enabled>false</enabled>")
		sendHttpPutRequest("http://admin:secret@192.168.192.85/ISAPI/System/IO/inputs/1","application/x-www-form-urlencoded; charset=UTF-8",Response)
	}
	
end

That is exactly what my new binding does and already works for Amcrest and Foscam cameras with the ability to update a picture when an alarm is triggered. I need someone to help test with Hikvision so if you are interested let me know and post a sample of the debug log output showing the motion ON and also OFF. If you want any other alarms also post a copy of the trigger output showing both states.

The file has HIK-ALPHA on it.

Thanks to all for your reply

best regards

Ossy

Hi there

I tryed both solutions, but it doesn’t work :frowning:

First one doesn’t exist anymore with my version.
Here the reply:
<?xml version="1.0" encoding="UTF-8"?>

/ISAPI/Image/channes/1/WDR
4
Invalid Operation
invalidOperation

For the second one I got the same answer, but it should exists in version 2.

My camera uses Version V5.3 build 171025

I tryed to enable “ISAPI/System/Video/inputs/channels/1/motionDetectionExt” and in the webinterface it gets active, but doesn’t work.
If someone has a solution, then share it with me :slight_smile:
Best regards

Ossy

I’m not sure if I want the same

In my hikvision setup, I can trigger event in hikvision
When my doorbel is rang, I would like to trigger an alamr inside hikvision

I see something like 192.168.254.10:8000<-1

I have two questions about that:
That are the hikvision ip adresses, so I guess these can’t be called from openhab
(the camera’s are connected to the hikvision box, so they don’t share a network)

  • if that last part is not true, how do I call this from openhab?