Hikvision setup

I hope someone can help me set up a Hikvision IP Camera.

I have configure the https settings like this:

#Camera switch: platform: hikvisioncam host: 192.168.0.x port: 443 name: Hikvision Cam 1 username: xxx password: xxx

But get this Error message 16-02-19 17:22:54 homeassistant.components.switch.hikvisioncam: Unable to connect: Connection to hikvision failed. Original exception: ConnectionError, "('Connection aborted.', BadStatusLine("''",))"

3 Likes

Do it like this…

#Camera switch: platform: hikvisioncam host: 192.168.0.x name: Hikvision Cam 1 username: xxx password: xxx

…and make sure you leave the https port default on camera (so in settings camera it should say 443.) Why?

Because the warning clearly stated “[color=#FF0000]Currently works using default https port only.[/color]”

Good luck and you’re welcome.

thanks for the quick reply.
This is the error messages I get now. It’s still shows port 80.

16-02-19 19:34:48 homeassistant.components.switch.hikvisioncam: Unable to connect: Connection to hikvision failed. Original exception: ConnectionError, "HTTPConnectionPool(host='192.168.0.x', port=80): Max retries exceeded with url: /System/deviceInfo (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x73b7e3f0>: Failed to establish a new connection: [Errno 111] Connection refused',))"

What do you exactly mean by leave the https port default? Where in the camera settings can I check this?
Attached you see my settings.

I checked the source and found the problem. Even though the warning states that it works on 443 only the code says otherwise

host = config.get(CONF_HOST, None) port = config.get('port', "80") name = config.get('name', "Hikvision Camera Motion Detection") username = config.get(CONF_USERNAME, "admin") password = config.get(CONF_PASSWORD, "12345")

Try setting your camera to 80 and defaults password/username and see if it works.
If it does revert back to your own secure settings and lodge a RFC on Github.

I think Paulus needs to check it.

I registered an issue on github.com/balloob/home-assistant/issues/1344

For those who had the same problem. I solved it for now with these settings:

camera: platform: generic still_image_url: http://192.168.0.96:8x/Streaming/channels/1/picture name: Hikvision Cam 1 username: your username password: your password

My friend. That is not a solution but a work around.

Have you tried my suggestion? That way we can tell if the hikvision component is indeed looking on port 80 instead of 443.

I can’t check since I do not have that specific camera.

did you solve?

Mine works using the picture function of the camera. HA refreshes the picture every 10 seconds if you havent highlighted the camera or every 1 second if you have it maximized.

- platform: generic
still_image_url: http://CAMERAIP:80/Streaming/channels/1/picture
name: Driveway
username: *****
password: *******
1 Like

@dennisation,
Is there a way to display Hikvision Live Stream in HASS without the 10sec delay?

Thanks

Use the following config:

camera:
  - platform: generic
    still_image_url: http://USER:[email protected]/ISAPI/Streaming/channels/101/picture

Replace the IP address of your camera. It updates almost every second.

Thanks for this! I noticed there’s still some delay. Could it be that the HA dashboard doesn’t refresh every sec?

Still the same.
It only updates every second if you click on the image.

Yes, every second is the expected behavior. The image updates every second.

In the default view it only updates every 10secs.
If you click on the image, only then it updates every 1sec.

Yes…that seems about right. Remember, HA is not a video surveillance system.

I understand that.

I guess my initial question should have been, can HASS display video streams in realtime

I don’t think so.

@Coolie1101 HASS can absolutely display a realtime video stream, but there are some caveats. You can only do it in the pop-up window (main page display is limited to a 10 second refresh) and you need to configure it as a “mjpeg” camera type, not generic.

For a hikvision camera I use a URL syntax like below:

camera:
  platform: mjpeg
  mjpeg_url: http://X.X.X.X/Streaming/Channels/2/preview
  username: user
  password: pass

You then need to make sure you have the substream set to “MJPEG” in your camera settings like the in the snapshot below.

2 Likes

That’s exactly what I’m getting now with it configured as Generic, and the sub-stream set to H.264.

In the pop-up window it refreshes every second which is not really real-time.

I’ll try your recommendation and report back.

That worked.

Any reason why it can’t be configured to use the H.264 stream?

Is this configuration info available somewhere?