Help with setting up zones (lighting issues)

Forum for questions and support relating to the 1.30.x releases only.
Locked
montagdude
Posts: 88
Joined: Fri Nov 10, 2017 6:05 pm

Help with setting up zones (lighting issues)

Post by montagdude »

One of my cameras is set up to monitor inside the garage. The garage doors have windows facing south, so there are lighting changes that occur throughout the day that can set off alarms. Also, when a garage door is opened, a light comes on and then turns off a few minutes later. I have set up zones with top edges just below the windows, and they extend onto the floor several feet in front of the door. The idea is to detect a person breaking in through the garage doors (there is no side door). I have attached an image from one of my events with blobs kind of outlining the zones for reference.

Now, here is the problem. I would like to filter out alarms caused by lighting changes throughout the day, but I would also like events when the garage door is opened to be recorded. With my other cameras, I have set up preclusive zones, which have proven quite effective for preventing alarms due to lighting changes. However, I can't do this in the garage, because I still want to capture events when the door is opened and the light turns on. Any ideas how to satisfy these two seemingly contradictory conditions? As the image suggests, I have switched to blob detection mode for now and removed the preclusive zones, but it is hard to filter out lighting changes this way. I can probably reduce the number of false alarms with careful tuning of the min and max settings for these zones, but it would be a lot better if I could still use preclusive zones somehow, since they seem to be more effective for that. It would be really nice if there were some sort of "preclusive disable" zone type so that I could put zones directly on the lights and have them temporarily disable the preclusive zones when the lights turn on.
Attachments
image.jpg
image.jpg (113.64 KiB) Viewed 2604 times
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Help with setting up zones (lighting issues)

Post by knight-of-ni »

Here is an overly complicated way:
Set up a moteino garagemote, which talks to a Raspberry Pi running the moteino gateway. Modify the moteino gateway to remotely set a different run state on the zm server, depending on whether the garage door is up or down. This would allow you to tune the motion settings when the door is open and then have a different motion setting when the door is down.
https://lowpowerlab.com/guide/garagemote/

I am nearly complete with this setup. I have finished the hardware setup and my moteino gateway works like a champ. I simply have not gotten around to modifying the moteino gateway to send commands to the zm server. I've got more projects than time allows.

This might be a little less complicated:
Turn off motion detection completely, and instead set up pir motion detectors to trigger the camera to record. You've have to get the pir to send a signal to the zm server over ethernet (an ESP8266 could do that).

Other considerations:
Even if you implement one of the solutions above or some other solution, you should consider that you aren't going to get a good image of the outside. The image of the outside, from inside the garage, will either be too light or too dark. The different lighting conditions are very hard on a camera. Your camera does not appear to have wdr (wide dynamic range). A good camera with WDR would be able to see through the garage windows. However, the best way to get the best image both inside and outside the garage is to have two cameras, one inside and the other outside the garage. That really is your best approach. Note that you can link cameras in zoneminder such that one camera causes the other to record.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
montagdude
Posts: 88
Joined: Fri Nov 10, 2017 6:05 pm

Re: Help with setting up zones (lighting issues)

Post by montagdude »

Thanks for the suggestions. The thought did cross my mind to use some other system to monitor when the garage door is open or closed and have that talk to ZoneMinder somehow. Given the extra money, time, and work involved, I would rather just deal with the false alerts instead.

I think what I will try first is to set up different garage monitors for night and day and only use preclusive zones for the day monitor. I already have night and day run states that I switch with cron + sunwait, so it wouldn't be much extra work to try it. During the day, the lighting change due to the garage light is obviously not as great, so maybe it would be possible to set up a preclusive zone that responds to sunlight changes but not the garage light during the day. And of course, at night there are no lighting changes from sunlight. I will probably still get some false alerts, but hopefully not very often.

Regarding monitoring outside, I wasn't intending for this camera to do that, but thanks for the tips anyway.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Help with setting up zones (lighting issues)

Post by rockedge »

there is a possibility to do something easy and cheap....using older X10 technology and zmTrigger.pl byusing a wireless motion detector that is communicates with a X10 transceiver connected by USB to a computer (or the ZM server itself). A Python driver for the CM19a gets polled for activity by a small PERL daemon. The MS16A ActiveEye Motion Sensor sends X10 ON and OFF signals also the motion sensor detects light and dark and can send a second ON and OFF signal.
the PYTHON driver software is here : https://cuddonnet.blogspot.com/2015/04/ ... tware.html

with a PERL program using Telnet connect with zmTrigger.pl and send the command strings to turn on zoneminder monitors to record events. There are many possibilities of using zmTrigger.pl. I have used it to display the outside temperature on the timestamp in the monitor stream views. Most certainly one could go to other types of systems to integrate with ZM...I am using the X10 as an example and that the X10 devices are cheap these days.

here are examples of a PERL daemon that polls the PYTHON driver of the CM19a Transceiver with a daemon controller.

/etc/init.d/zmusb12x

Code: Select all

#!/bin/sh

zmusb12_PID=/tmp/zmusb12.pid
function show_status {
	if [ ! -f $zmusb12_PID ]; then
		echo -e "ZMUSB12 NOTRUNNING"
		exit 3
	fi
	
	PID=`cat ${zmusb12_PID}`

	if [ ! -d /proc/${PID} &>/dev/null ]; then
		echo -e "ZMUSB12 NOTRUNNING"
		exit 1
	fi

	echo -e "ZMUSB12  RUNNING"
}

case "$1" in
    start)
	if [ -f /tmp/zmusb12.pid ]; then
		PID=$(cat /tmp/zmusb12.pid)
		kill -0 ${PID} &>/dev/null
		if [ $? = 0 ]; then
			echo "zmusb12 is already running."
		else
			/usr/bin/zmusb12.pl
			pidof zmusb12.pl > /tmp/zmusb12.pid
			PID=$(cat /tmp/zmusb12.pid)
			kill -0 ${PID} &>/dev/null
			if [ $? = 0 ]; then
				echo "zmusb12 started succesfully."
			else
				echo "Error starting zmusb12"
			fi
		fi
	else
		/usr/bin/zmusb12.pl
		pidof zmusb12.pl > /tmp/zmusb12.pid
		PID=$(cat /tmp/zmusb12.pid)
		kill -0 ${PID} &>/dev/null
		
		if [ $? = 0 ]; then
			echo "zmusb12 started succesfully."
		else
			echo "Error starting zmusb12"
		fi
        fi
        ;;
    stop)
	if [ -f /tmp/zmusb12.pid ];then
		PID=$(cat /tmp/zmusb12.pid)
		kill -0 ${PID} &>/dev/null
		rm -f /tmp/zmusb12.pid
		if [ $? = 0 ]; then
			/bin/kill ${PID}
			kill -0 ${PID} &>/dev/null
			if [ $? = 0 ]; then
				echo "zmusb12 stopped succesfully."
			else
				echo "Error stopping zmusb12"
			fi
		else
			echo "zmusb12 is already stopped."
		fi
	else
		echo "zmusb12 is already stopped."
	fi
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    status)
		show_status
		;;
    *)
        echo "Usage: $0 start|stop|restart|reload|status"
        exit 1
esac
exit 0
This is the daemon :

/usr/bin/zmusb12.pl

Code: Select all

#!/usr/bin/perl -w

use strict;
use warnings;
use autodie;
use IO::Socket::INET;
use LWP::UserAgent;
use Proc::Daemon;
my $continue = 1;
my $monitor = 2;
my ($socket);

Proc::Daemon::Init;
$SIG{TERM} = sub { $continue = 0 };

open (my $LOG, '>>', '/var/log/cm19a/cm19a.log');
select $LOG;

$| = 1;

  print localtime()." Started zmusb12\r\n";

  my $get_url = 'http://localhost:8008/?command=getqueue';
  my $cmdon = $monitor.'|on+90|255|motion sensor|downstairs|motion sensor';
  my $cmdoff = $monitor.'|off|0|||';

  my $ua = LWP::UserAgent->new;

sub start_sock() {  
  $socket = new IO::Socket::INET (
    PeerHost => 'localhost',
    PeerPort => '6802',
    Proto => 'tcp',
  ) or die "ERROR in Socket creation : $ !\n";
 print "Connected to Socket \n";
}
sub run_cmdon() {
           start_sock();
           my $size = $socket->send($cmdon);
           print "sent data ON: length $size\n";
           print "----------------------------- \n";
           shutdown($socket, 1);	
}	
sub run_cmdoff() {
           start_sock();
           my $size = $socket->send($cmdoff);
           print "sent data OFF: length $size\n";
           print "----------------------------- \n";
           shutdown($socket, 1);	
	
}
 
 while($continue)
 {
     my $req = $ua->get($get_url);
     my $html = $req->decoded_content;
   if ($html !~ /Receive queue is empty/ ) {
     
     print localtime()."  $html\r";
   
    if ($html =~ /A1ON/) { run_cmdon(); }
        
    if ($html =~ /A1OFF/) { run_cmdoff(); }
   
   $socket->close() if $socket;
}
sleep 1;
}

   print localtime()." Stopped zmusb12\r\n";
Using zmTrigger.pl via telenet
montagdude
Posts: 88
Joined: Fri Nov 10, 2017 6:05 pm

Re: Help with setting up zones (lighting issues)

Post by montagdude »

Thanks for the ideas. I will definitely keep them in mind if I end up deciding to use a separate garage door sensor.
Locked