[RELEASE] Hikvision Alarm (HTTP Listening/Data Streaming/Alarm Server)

I just tested it on my setup and both "Motion" and "Attribute -> Motion" work as expected.

In the log, there won't be an "Alert Active" entry. The "Event Type: VMD <DATE/TIME>" log entry shows that the event was received from the camera. The "Triggered: M[X]...." shows that the Motion sensor is triggered and is now in the "triggered" state. The "MOTIONSENSOR: Alert Inactive" log entry is when it reverts back to the "untriggered" state after the Alert Reset Time (seconds) has elapsed. The "triggered" and "untriggered" states normally map to "Motion Active" and "Motion Inactive" respectively unless you enable the "Invert Sensor Output State" in the driver preferences page, which will reverse these.

The virtual buttons are additional options when Motion, Presence, and Contact aren't enough to map everything you want to unique events for you to distinguish between. It's not necessary in your case if you're just interested in triggering on motion events.

Overall, what you have described and shown in the logs seems to indicate everything is working. Have you tried to use the motion sensor in a Rule Machine rule to trigger something to yourself?

Hi,

Do you think this will work on the ISAPI feed from the KV6113 Hikvision IP Video intercom, this has a door bell push button, which I’d like to capture as an event. It also has a “door open” event as well

2 Likes

Sorry... I did spend a couple of week trying to figure out a way to work with the ISAPI stream, but with my limited experience, I couldn't find any mechanism for Hubitat to properly talk to it. Maybe I'll revisit it someday if I can find some time or if someone more knowledgeable could point me in the right direction.

I'll have some errors when I'm using this driver.

dev:362021-11-26 22:48:57.962 errororg.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)

dev:362021-11-26 22:48:57.962 errororg.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)

Can you give me more information? Is dev:36 the virtual device?

Hi.
Yes, Dev:36, Dev:37 and Dev:38 is virtual devices with this HIKVision driver.
Only dev:36 show this error.
Dev:36 is a DS-2CD2386G2-ISU/SL
Dev:37 is a DS-2CD2346G1-I
Dev:38 is a DS-2CD2346G1-I

The rest of the settings seems to work, the states are the following:

State Variables

  • contactON : open
  • presenceOFF : not present
  • enableBtn1 : true
  • enableBtn2 : true
  • camDNI : C0A80119
  • enableBtn3 : true
  • enableBtn4 : true
  • enableBtn5 : true
  • hubIP : 192.168.1.202:39501
  • motionOFF : inactive
  • enableBtn6 : true
  • presenceON : present
  • eventTypeFilterBtn3 : null
  • eventTypeFilterBtn2 : null
  • eventFilterPresence : null
  • eventTypeFilterBtn1 : null
  • motionON : active
  • eventTypeFilterBtn6 : null
  • eventTypeFilterBtn5 : null
  • eventTypeFilterBtn4 : null
  • eventFilterMotion : null
  • eventFilterContact : null
  • contactOFF : closed

The log show this:

dev:362021-11-27 09:12:33.626 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:33.623 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:33.620 infoEvent Type: VMD (2021-11-27T09:12:31+01:00)
dev:362021-11-27 09:12:32.623 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:32.620 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:32.618 infoEvent Type: VMD (2021-11-27T09:12:30+01:00)
dev:362021-11-27 09:12:31.623 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:31.620 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:31.617 infoEvent Type: VMD (2021-11-27T09:12:29+01:00)
dev:362021-11-27 09:12:30.624 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:30.621 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:30.618 infoEvent Type: VMD (2021-11-27T09:12:28+01:00)
dev:362021-11-27 09:12:29.621 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:29.619 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:29.616 infoEvent Type: VMD (2021-11-27T09:12:27+01:00)
dev:362021-11-27 09:12:28.619 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:28.616 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:28.613 infoEvent Type: VMD (2021-11-27T09:12:26+01:00)
dev:362021-11-27 09:12:27.619 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:27.616 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:27.613 infoEvent Type: VMD (2021-11-27T09:12:25+01:00)
dev:362021-11-27 09:12:26.621 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:26.618 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:26.615 infoEvent Type: VMD (2021-11-27T09:12:24+01:00)
dev:362021-11-27 09:12:25.619 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:25.616 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:25.613 infoEvent Type: VMD (2021-11-27T09:12:23+01:00)
dev:362021-11-27 09:12:25.169 errororg.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)
dev:362021-11-27 09:12:25.114 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:25.111 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:25.108 infoEvent Type: duration (2021-11-27T09:12:23+01:00)
dev:362021-11-27 09:12:24.617 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:24.614 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:24.611 infoEvent Type: VMD (2021-11-27T09:12:22+01:00)
dev:362021-11-27 09:12:24.269 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:24.266 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:24.263 infoEvent Type: duration (2021-11-27T09:12:22+01:00)
dev:362021-11-27 09:12:24.012 errororg.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)
dev:362021-11-27 09:12:23.619 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:23.616 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:23.612 infoEvent Type: VMD (2021-11-27T09:12:21+01:00)
dev:362021-11-27 09:12:23.331 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:23.328 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:23.325 infoEvent Type: duration (2021-11-27T09:12:21+01:00)
dev:362021-11-27 09:12:22.618 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:22.615 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:22.612 infoEvent Type: VMD (2021-11-27T09:12:20+01:00)
dev:362021-11-27 09:12:22.415 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:22.412 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:22.409 infoEvent Type: duration (2021-11-27T09:12:20+01:00)
dev:362021-11-27 09:12:21.617 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:21.614 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:21.611 infoEvent Type: VMD (2021-11-27T09:12:19+01:00)
dev:362021-11-27 09:12:21.575 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:21.572 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:21.570 infoEvent Type: duration (2021-11-27T09:12:19+01:00)
dev:362021-11-27 09:12:20.669 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:20.666 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:20.663 infoEvent Type: duration (2021-11-27T09:12:18+01:00)
dev:362021-11-27 09:12:20.614 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:20.612 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:20.609 infoEvent Type: VMD (2021-11-27T09:12:18+01:00)
dev:362021-11-27 09:12:19.775 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:19.772 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:19.769 infoEvent Type: duration (2021-11-27T09:12:17+01:00)
dev:362021-11-27 09:12:19.613 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:19.611 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:19.608 infoEvent Type: VMD (2021-11-27T09:12:17+01:00)
dev:362021-11-27 09:12:18.909 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:18.906 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:18.903 infoEvent Type: duration (2021-11-27T09:12:16+01:00)
dev:362021-11-27 09:12:18.612 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:18.609 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:18.606 infoEvent Type: VMD (2021-11-27T09:12:16+01:00)
dev:362021-11-27 09:12:18.082 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:18.079 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:18.076 infoEvent Type: duration (2021-11-27T09:12:16+01:00)
dev:362021-11-27 09:12:17.612 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:17.609 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:17.606 infoEvent Type: VMD (2021-11-27T09:12:15+01:00)
dev:362021-11-27 09:12:17.192 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:17.189 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:17.187 infoEvent Type: duration (2021-11-27T09:12:15+01:00)
dev:362021-11-27 09:12:17.171 errororg.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)
dev:362021-11-27 09:12:16.612 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:16.609 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:16.606 infoEvent Type: VMD (2021-11-27T09:12:14+01:00)
dev:362021-11-27 09:12:16.298 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:16.296 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:16.293 infoEvent Type: duration (2021-11-27T09:12:14+01:00)
dev:362021-11-27 09:12:15.619 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:15.608 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:15.604 infoEvent Type: VMD (2021-11-27T09:12:13+01:00)
dev:362021-11-27 09:12:14.805 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:14.802 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:14.799 infoEvent Type: VMD (2021-11-27T09:12:12+01:00)
dev:362021-11-27 09:12:13.623 infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
dev:362021-11-27 09:12:13.620 infoTriggered: M[ ] P[ ] C[ ]
dev:362021-11-27 09:12:13.617 infoEvent Type: VMD (2021-11-27T09:12:11+01:00)
--- Live Log Started, waiting for events ---

Hmmm... A few things:

  1. Besides seeing these errors in the log, is it otherwise working?
  2. If you switch the cameras around, does the problem follow the camera or stays with the virtual device?
  3. On the problem camera, which events currently have "Notify Surveillance Center" checked? In your log, the event type "duration" is unfamiliar to me.
  4. Can you confirm which line of code is on line 256?

Hi, I have been trying for the last few days to get this integrated but with my limited knowledge I am struggling. Part of me feels like I'm close :upside_down_face:

I've been following DS-KD8003 - DS-KV8113 - DS-KV8213 - DS-KV6113 - DS-KV8413 and .... integration Hikvision HikConnect Video intercom doorbell - Share your Projects! - Home Assistant Community guide to be able to see when the button is pressed/doorbell is ringing.

When I go too "http://usrname:Password@IP Address/ISAPI/VideoIntercom/callStatus?format=json" It does show when the doorbell is idle/ringing/oncall.
I'm just struggling to find/build a driver to be able to read this information/do a http get poll.
My idea was to have a virtual sensor triggered by the HTTP Response, then a rule so when someone presses the doorbell button (http auto changes to ringing) this then changes state of virtual sensor to then play a doorbell chime, flash light, etc.

This driver created by @kleung1 is brilliant, I don't know how easy it'd be for doorbell callstatus to be integrated into it?

I tried to get something to work with Hikvision's ISAPI, but just couldn't. In my search, I found Hubitat's httpGet. I can use to to interact with ISAPI for non-continuous/stream stuff, but could not get it to work with ISAPI event streams. I asked for help in a separate thread, but received no response: httpGet of continuous stream?

I assume httpGet is incapable of this and there is no other mechanism for Hubitat to receive the stream.

1 Like

Hi @kleung1 - thanks very much for your work, it's a great idea and now i'm having fun trying to get it to work! I'm not a software developer, so have been testing with trial and error to try make this work and appreciate any advice you can provide.

I have a DS-2CD2386G2-I running firmware V5.7.10 build 220830, with a Hubitat C5 2.3.2.141.
I have installed the driver and configured it successfully (the Hik 'Alarm Server' successfully communicating with the Hubitat by Hik GUI saying success and the Hubitat showing some events in the Log).

I am trying to trigger a TTS announcement when the camera detects a human. I have configured the Hik via Event>Basic Event>Enable Motion Detection, Draw Area and select 'Human'. I have ensured the Hik Schedule and Linkage Method are set correctly.
When i walk in front of camera the Hubitat Log shows;

[error] org.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)

I have tried many different ways to get triggers to work and found that using Event>Smart Event>Intrusion Detection does give some usable triggering. During this event the Hubitat log shows;

infoButtonsPushed: 1[ ] 2[ ] 3[ ] 4[ ] 5[ ] 6[ ]
infoTriggered: M[X] P[X] C[X]
infoEvent Type: duration (2022-09-19T19:00:40+10:00)

I feel like it is really close to working and maybe some Driver adjustments.
Are you able to provide any tips on how i can debug/adjust the Driver to work?
I can provide the http:///ISAPI/Event/triggers output if this is useful?

Thank you again for your help

Do you have both info logging and debug logging enabled when the error occurred? Can you post a larger portion of the log around the error? I haven't looked at the code in a long time, so I'll need to re-familiarize myself with it. And I've never tested this with an Accusense camera, so the event type or the XML structure may be causing problems.

So is there no way to get this working if your cams are connected to the NVR and powered by the POE ports?

Reading a few pages up it seems not as they're on their own subnet.

I have a 16 port NVR but only using 9 of the ports. If I connect a spare port directly to the NVR would this work? This is how I have it setup currently and all my cameras and NVR show up in the SADP app but obviously they still have their 192.168.254....... IP rather than my home networks.

Does anyone know if there is a workaround?

Thanks

Unfortunately, I'm not aware of any way to get it to work when the cameras are sitting behind an NVR. This requires the camera itself to initiate the connection to the hub and send a properly-formatted message, so the problem is really all on the camera/NVR side.

Hi everyone. I'm revisiting an error originally reported by @Tursoe and @user2509 where the driver does not work and logs show the following error:

org.xml.sax.SAXParseException: Content is not allowed in prolog. on line 256 (method parse)

I was unable to reproduce this behavior at that time because my cameras did not exhibit this behavior. I recently added a G2 (DS-2CD2347G2-LU) camera and I am seeing this same issue.

After a brief investigation, I see that the newer cameras send a different POST message. Older cameras sends POSTs with content-type application/xml; charset="UTF-8" and the XML is in the body of the message.

On newer cameras, it sends POSTs with content-type multipart/form-data; boundary=boundary and the XML is a file.

Unfortunately, due to my limited experience is SW development, Groovy, & Hubitat development, I don't know to properly handle this. I've created a thread in the Developers section to ask for help. If anyone can point me in the right direction, I would appreciate it. I would like to have this fixed.

Hi

I am trying to use these driver for ezviz cameras and a hikvision ax pro alarm

I know it is for cameras but i would like to conect those devices but cant find a driver.

I don't have any experience with (or access to) EZVIZ or AX Pro. Do these products have an option for "HTTP Listening" or "HTTP Data Transmission" or "Alarm Server"? If so, this could work for you. And if the messages it pushes is different from what I have currently supported, it can be added.

I can set an alarm central and point it to my Hubitat. But I don't know what kind of messages is the alarm sending and what kind of protocol use.

Wow, I am so glad I found this post, since this driver is just what I'm looking for, which is a good example of an http listener parsing inbound content-type app/xml because I want to add this functionality into my just released today BETA Hikvision Actuator. But what I'm not so glad about is having to deal with two different response structures, the latter of which I would have no clue how to parse, requiring far more effort. Bummer. I have the Hikvision ISAPI and IPMD guides but they're from 2012 and 2009. But they're no good for me here. Has anyone been able to decipher and parse that multipart out to get to the good stuff? thanks

And wow again, I may be a stupid newbie, but just how do i go about configuring this driver. Do I have to change something in the code? Where are all those input fields i see in the code? All I see in preferences is cam ip. Is there a user guide for this driver?

What do you see in the logs?