My system is currently configured for a "sunrise/sunset" configuration. This is done through two cron jobs running under the apache user:knnniggett wrote:1) Delete all the preclusive zones. Do not advance w/o first doing this.
2) Read the documentation regarding run states. Your goal will be to set up two run states. One for day and the other for night.
3) With your run state in the "day" run state, tune your motion zone(s) for the day. I recommend you start with just one zone. Intentionally make the zone more sensitive than you need so you can see the motion statistics. Then gradually adjust the zone configuration to be less sensitive.
4) With the system in the "Night" run state, tune your motion zone(s) for the night. I recommend you start with just one zone. Intentionally make the zone more sensitive than you need so you can see the motion statistics. Then gradually adjust the zone configuration to be less sensitive. This zone is expected to be less sensitive than the "day" run state.
5) Instead of using preclusive zones, use the Max Alarm/Filtered/Blob fields to ignore events that are too big since they are likely to be headlights. Keep in mind that, if a car pulls into your driveway at night, then zoneminder will likely not record it as motion if you are using the Max Alarm/Filtered/Blob fields. A preclusive zone will have the same problem. At night, anything large that moves into your active motion zones could get ignored because, with the headlights on, it will have tripped a preclusive zone.
Code: Select all
0 01 * * * /usr/local/bin/zm-sun.sh sunrise
0 13 * * * /usr/local/bin/zm-sun.sh sunset
Code: Select all
#!/bin/bash
# script to start / stop ZoneMinder based on sunrise / sunset
#
# usage:
# zm-sun.sh sunrise
# zm-sun.sh sunset
if [[ "$1" == "sunrise" ]]
then
/usr/local/bin/sunwait sun up -00:30:00 00.000000N 000.000000W ; /usr/bin/zmpkg.pl 'sunrise'
curl -XPUT -k https://127.0.0.1/zm/api/monitors/1.json -d "Monitor[AlarmFrameCount]=1"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/2.json -d "Monitor[AlarmFrameCount]=1"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/3.json -d "Monitor[AlarmFrameCount]=1"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/4.json -d "Monitor[AlarmFrameCount]=1"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/5.json -d "Monitor[AlarmFrameCount]=1"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/6.json -d "Monitor[AlarmFrameCount]=1"
elif [[ "$1" == "sunset" ]]
then
/usr/local/bin/sunwait sun down +00:30:00 00.000000N 000.000000W ; /usr/bin/zmpkg.pl 'sunset'
curl -XPUT -k https://127.0.0.1/zm/api/monitors/1.json -d "Monitor[AlarmFrameCount]=2"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/2.json -d "Monitor[AlarmFrameCount]=2"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/3.json -d "Monitor[AlarmFrameCount]=2"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/4.json -d "Monitor[AlarmFrameCount]=2"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/5.json -d "Monitor[AlarmFrameCount]=2"
curl -XPUT -k https://127.0.0.1/zm/api/monitors/6.json -d "Monitor[AlarmFrameCount]=2"
fi
echo [`date`] Zoneminder $1 >> /var/log/zoneminder/sunwait.log
exit
Now, as part of how I originally set this up, I had assumed each "run state" of zoneminder could have its own unique zones defined for each camera. Day time has to deal with fog and clouds, and night time has to deal with headlights sweeping across places, and neighbor's overly sensitive motion lights. I had found it easier to adjust the number and size/shape of the zones to deal with these situations.
I discovered however, that zoneminder did not support different zones per state: ( viewtopic.php?f=34&t=24305&p=92854#p92854 ).
In the instructions above (#3 and #4), it sounds like zone settings are adjustable by run state now. Have things changed since February?
As for #5, I was wondering if it is now possible to use the API to query each event for their alarmed frames and from each of these frames, the statistical information. What I'd like to do is crank the sensitivity up on my zones, let them run for a few days, manually go through the events and "archive" the positives (as a way to separate the good from the bad), and finally write something to retrieve the stats, first going through the archives to find the numbers of what I want to use to trigger the zones, and finally going through the rest to see what min/max settings I can apply to safely not trigger the zones. Has anyone already attempted this?