Hikvision event stream sensors

In the root of custom_components. I didn’t know it should follow the components structure of the main code. I’ll give it a try next time you have an update :slight_smile:

I was reading documentation that you posted in your pull request, and noticed delay parameter. I think it might be useful to have different delays for the transitions off => on and on => off.
For example, I want to see “on” in HA immediately, however “off” can be delayed to suppress multiple quick trips as you propose in the docs.

That is how it currently works. The delay will only apply to the off state, not the on state.

@mezz64 So far it is working well for me.

While going through the config for multiple cameras, I had an idea about removing the domain and camera id from the sensor under customize. I feel this will make it easier to setup the cameras.

  • example: binary_sensor.front_line_crossing: becomes line_crossing: in the customize section.

It may also bring it in line with what I have seen in other component configs. But I have found in the past the example of existing components is not always the best practice.

You have a valid point. Since each camera only has binary_sensors and has it’s own customize section it doesn’t make sense to require the sensor type or the camera name in the customize because they can’t change.

PR has been updated.

This functionality has been merged into the latest dev build and it slated to be in the 0.35 stable release.

1 Like

Getting the following error repeatedly in my HA log file.

pyhik.hikvision: Problem finding attribute: list index out of range

Can you please post a more complete log file as well as your configuration and camera type?

Mezz64

I realized going back and looking at the configuration that I had a second camera that I had included was not a true hikvision but an LTS camera who rebadges hikvision.

I am including the xml from this camera to see if maybe it can be added.

triggers.xml (4.6 KB)

Based on that XML the issue looks to be a different XML namespace.

The default hikvision namespace is: http://www.hikvision.com/ver20/XMLSchema
And the LTS camera reports: http://www.std-cgi.com/ver20/XMLSchema

Otherwise the response looks the same so it should be compatible with the existing logic that processes the event stream. Since I can fetch the namespace on the initial camera call i’ll look into making it dynamic rather than hard-coded so other rebaged cameras can hopefully be compatible as well.

Will you be available to test? You’ll need to do a local pip install as described earlier in this thread and edit the version requirement in the hass platform file when the time comes.

Sure. I can test it out. Thanks!

This turned out to be an easy addition so I pushed the necessary changes to the library here:

You can either download the new version and do a local pip install or point pip to the repository and do it that way. Update the REQUIREMENTS line in the hikvision.py file under the binary_sensors direcotry in your hass install to point to 0.0.7 to make it use the new library.

Let me know how things work out.

1 Like

Thanks for the quick turnaround. Working the same as my Hikvision camera now.

Awesome. I’ll push it up to pypi and get a PR in to update the version requirement tomorrow.

I have a Hikvision camera rebadged and sold by ADI Technologies.

Model: 0E-13BF40
Firmware Version: V5.3.0 build 160329

I was hoping I’d still be able to use this binary_sensor component despite it not being a legitimate Hikvision camera. It doesn’t appear to be the case. I’m getting the

pyhik.hikvision: Problem finding attribute: list index out of range

error and was wondering if the solution would be as simple as that for drizzay’s problem.

Are you running the stable or dev branch of Home Assistant? The changes that fixed @drizzay problem (and hopefully yours) haven’t been merged into the stable branch yet.

If you are on stable give the dev branch a try to see if it fixes your problem. If you are on dev please post an XML sample from: http://yourcamip/ISAPI/Event/triggers and we’ll go from there.

Oh perfect! My schema also happens to be http://www.std-cgi.com/ver20/XMLSchema.

I’m running the stable branch: 0.35.3

Here is my schema.
triggers.xml (4.3 KB)

Your cameras should work fine after the next stable release. If you’d like to try now but don’t want to commit to running full blown dev you can edit the REQUIREMENTS line at the top of the hikvision.py file under the binary_sensors directory in your hass install to point to “0.0.7” to make it use the new library with the fix.

Awesome. Thanks for the help!

Hi,
Im running 0.35.3 and have two hikvision cameras (DS-2CD2532F-IWS).
I have set up binary_sensors for miton, line cross and intrution detection.
My problem is that these binary_sensors seems to stop responding efter a day more or less! I have not set up any delay on the sensors.
I cant seem to find anything in the default log either, which could explain this.

In addition, if I “hide” the sensors in 1 or more levels of group, these sensors will not respond at all. But that problem I believe has to do with HA and not the Hikvision implementation?

1 Like