Reducing False Alarms with IP Camera Motion Detection

I recently set up my Hikvision PTZ camera to monitor my driveway, and I wanted to share my experience and solution for reducing false alarms. Initially, I relied solely on the camera’s smart events, but I found that it resulted in far too many false alarms despite tweaking various settings.

To address this, I decided to integrate my z-wave motion-activated floodlight with the PTZ camera. The idea was simple: trigger an event only if both the floodlight’s PIR sensor and the camera’s motion sensor detect motion. This dual-sensor approach has been incredibly effective in eliminating false alarms.

Here’s how it works: I used OpenHAB to create switch items for both the camera’s linecross event and the floodlight’s PIR motion event. Each switch has an expiration feature, ensuring they remain ‘ON’ for a defined period after detecting motion. I set this to 59 seconds, but you can adjust it based on your needs.

I also created a rule to check if both sensors are triggered simultaneously. If they are, I receive a text message notification. To prevent multiple notifications, I added an expiration timer to the main motion detected switch, ensuring it only triggers once every 3 minutes.

Here’s the code I used:

rule “PTZ Camera has detected line cross”
when
Item PTZ_LineCrossStatus changed from OFF to ON or Item PTZ_LineCrossStatus changed from NULL to ON
then
if (Flood_Driveway_Motion.state == ON && DrivewayMotionDetected.state != ON) {
val mailActions = getActions(“mail”,“mail:smtp:gmailsmtp”)
mailActions.sendMail(“905xxxyyyy@txt.bell.ca”,“Message from OpenHab”,“Driveway Motion Detected”)
DrivewayMotionDetected.sendCommand(ON)
}
end

rule “Flood_Driveway_Motion is ON”
when
Item Flood_Driveway_Motion changed from OFF to ON or Item Flood_Driveway_Motion changed from NULL to ON
then
if (PTZ_LineCrossStatus.state == ON && DrivewayMotionDetected.state != ON) {
val mailActions = getActions(“mail”,“mail:smtp:gmailsmtp”)
mailActions.sendMail(“905xxxyyyy@txt.bell.ca”,“Message from OpenHab”,“Driveway Motion Detected”)
DrivewayMotionDetected.sendCommand(ON)
}
end

This setup has been a game-changer for me. It ensures that I’m only notified when there’s actual activity in my driveway, and it’s virtually eliminated false alarms. I hope this helps others who are struggling with similar issues!

If you have any questions or suggestions, feel free to reach out. Happy automating! :rocket: