fbpx

How to Connect Surveillance Camera Line Cross Sensors to Home Assistant

You have IP surveillance cameras and a Home Assistant setup and you are wondering if you can integrate the two. I was in exactly the same boat a couple of months ago and was pleasantly surprised to see that integrating my Hikvision security cameras was pretty straight forward. In this article, I will walk you through the process I took get get everything setup.

Step 1: Why Integrate your Surveillance Cameras with Home Assistant?

Home Assistant is all about sensors and some surveillance cameras have a bunch of them! In my case, my Hikvision DS-2CD2142FWD-I cameras have the following sensors:

  • Face Detection
  • Field Detection
  • Line Crossing
  • Illegal Access

You can use these sensors to trigger automatons in your Home Assistant setup. I use the surveillance camera covering my front driveway to control security lights at the front of my house and my internal kitchen light. So, if there someone walks up to my gate when the sun has set, my setup (Node-RED & Home Assistant) will turn on my security lights and my kitchen light. This would give a potential intruder the impression that someone is home and they have been seen. It is also handy to have the lights turn on when when we arrive home in the dark.

Step 2: Configuring Surveillance Cameras for Home Assistant (Hikvision in my case)

Before you do anything in Home Assistant, you need to make sure that your camera settings are correctly set. I am using 4 Hikvision DS-2CD2142FWD-I cameras so these are the setting that I needed to check/change to make sure they would work with Home Assistant.

First you need to log into each camera, open the System > Security > Authentication from the menus, make sure the ‘Web Authentication’ is set to digest/basic and click save if you make any changes.

Next you need to browse to System > User Management > User Management and click on the Modify button. If you are only using the default admin user account, then the ‘Remote: Notify Surveillance Center/Trigger Alarm Output’ should already be ticked. If not, make sure it is ticked and save the updates.

Click the Modify button
Make sure the ‘Remote: Notify Surveillance Center/Trigger Alarm Output’ field is ticked

Finally, browse to Event > Basic Event or Smart Event and make sure the ‘Notify Surveilance Center’ setting in the ‘Linkage Method’ are ticked. This makes sure that your security camera will create a notification when there is some sort of event (Motion Detection) in this case. I personally prefer to stick to Line Cross Detection as it results in less false positive events.

Enabling the Notify Surveillance Center setting in Hikvision cameras

Step 3: Configuring Home Assistant for Surveillance Cameras (Hikvision in my case)

In this next step, you need to open your Home Assistant configuration.yaml file and add the following code. If you already have binary sensors, then don’t repeat the binary_sensor: line, just add each cameras setting one at a time below the existing binary_sensor: line. Is the example below, two camera would be added.

binary_sensor:
  - platform: hikvision
    host: 192.168.1.3
    port: 80
    ssl: false
    username: !secret hikvision_username
    password: !secret hikvision_password
    customize:
    motion:
      delay: 10
    line_crossing:
      ignored: false

  - platform: hikvision
    host: 192.168.1.4
    port: 80
    ssl: false
    username: !secret hikvision_username
    password: !secret hikvision_password
    customize:
    motion:
      delay: 10
    line_crossing:
      ignored: false

Step 4: Surveilance Camera Entities in Home Assistant

In the final step, you will just need to restart Home Assistant and then browse to Configuration > Entities, search for your new Hikvision entities and then start using them for automations!

If you do not see the camera entities, then take a look at this link to troubleshoot Hikvision cameras: https://www.home-assistant.io/integrations/hikvision/

Step 5: Using Node-RED and Surveillance cameras in Home Assistant Automations

Now that your surveillance camera entities are up and running, you can start using them in Node-Red for automations. In the flow below, I use my front gate and driveway Hikvision camera line-cross sensors to trigger my security and kitchen lights but only when the sun has set (using the Sun State node). I also integrated a timer so that the lights turn off after 5 min if there is no more movement.

One improvement that I need to make to this flow is to only turn the kitchen lights off if they where already off before the trigger event.

Can you trigger the Paradox Alarm via the Paradox IP150?

The answer is no and yes. Take a look at this article of mine that covers this in a lot more detail and explains a workaround solution:

Recent Posts