Clone monitor + zones

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
johnnytaco
Posts: 26
Joined: Sun Feb 26, 2017 3:16 pm

Clone monitor + zones

Post by johnnytaco »

It would be convenient to clone zones along with the monitor. That seems to be the only thing not cloned.

Thanks!
jt
kmg454
Posts: 58
Joined: Tue Apr 11, 2017 7:43 am

Re: Clone monitor + zones

Post by kmg454 »

Good gesture it will be very useful because I have 120 camera's same brand and same settings, if I can clone these cams the only thing to change is the port.
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Clone monitor + zones

Post by iconnor »

You can already clone a monitor, but we didn't have it clone the zones because we can't imagine any two cameras having the same zones.
WolfpackFan
Posts: 12
Joined: Thu Aug 10, 2017 10:32 pm

Re: Clone monitor + zones

Post by WolfpackFan »

iconnor wrote: Tue Jul 25, 2017 1:09 pm You can already clone a monitor, but we didn't have it clone the zones because we can't imagine any two cameras having the same zones.
I'm not sure how most folks are using this feature but I use it to clone monitors and will only tweak settings for colorscale and frames captured in order to be able to switch back and forth the same camera with different qualities and load on the CPU/disk. In that case copying the zones would be helpful.
montagdude
Posts: 88
Joined: Fri Nov 10, 2017 6:05 pm

Re: Clone monitor + zones

Post by montagdude »

Another use case: using duplicate monitors to change motion detection sensitivities at different times of the day.

viewtopic.php?f=36&t=26716
ebeng
Posts: 12
Joined: Tue May 28, 2019 6:30 pm

Re: Clone monitor + zones

Post by ebeng »

Had the same question, hope that it helps some-one:

Let's say you have Zones Id=1 which is applied to MonitorId=1
You want this to copy to MonitorId=2

Do the Following (login to mysql, use zm database):

Code: Select all

insert into Zones (Id, MonitorId , Name , Type , Units , NumCoords , Coords , Area , AlarmRGB , CheckMethod , MinPixelThreshold , MaxPixelThreshold , MinAlarmPixels , MaxAlarmPixels , FilterX , FilterY , MinFilterPixels , MaxFilterPixels , MinBlobPixels , MaxBlobPixels , MinBlobs , MaxBlobs , OverloadFrames , ExtendAlarmFrames)
select              2, 2 , Name , Type , Units , NumCoords , Coords , Area , AlarmRGB , CheckMethod , MinPixelThreshold , MaxPixelThreshold , MinAlarmPixels , MaxAlarmPixels , FilterX , FilterY , MinFilterPixels , MaxFilterPixels , MinBlobPixels , MaxBlobPixels , MinBlobs , MaxBlobs , OverloadFrames , ExtendAlarmFrames
from Zones
where Id = 1;
the select part:
you need to enter first the new Zones-Id (check first if there is already this Id. I've used for simplicity Id=2)
Then you need to apply it to your MonitorId which is the second '2' in the select part
LostInTheSauce
Posts: 2
Joined: Mon Feb 24, 2020 10:18 pm

Re: Clone monitor + zones

Post by LostInTheSauce »

montagdude wrote: Mon Nov 13, 2017 8:38 pm Another use case: using duplicate monitors to change motion detection sensitivities at different times of the day.

viewtopic.php?f=36&t=26716
Totally agree with you on this use case. If you have already found a solution, I'd love to hear it...
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Clone monitor + zones

Post by iconnor »

I'd be willing to make this work for 1.35/1.36.

At the moment my personal financing is in trouble due to COVID-19, so I'm going to create an issue, and a bounty.

If people want this sooner rather than later, they might consider posting bounties, become a patron on patreon.com, or at least do some social media sharing about ZM.

https://github.com/ZoneMinder/zoneminder/issues/2906
User avatar
jlw52761
Posts: 12
Joined: Thu Dec 03, 2020 9:29 pm

Re: Clone monitor + zones

Post by jlw52761 »

I use different Zones for Day/Night and have a cron job that runs to set the Active/Inactive setting on the zone depending on the time of day and sunrise/sunset. I also manually clone zones using SQL, not very difficult but would be nice to have this directly in the Zones page for cloning within the same monitor.

To get the Zones, I run this SQL code:

Code: Select all

select Id,MonitorId,Name from Zones;
Then, I edit my zone_duplicate.sql file to change the Id of the Zone I want as the source, then in ZM GUI you can rename it. The key is the Zone name must be prefixed with "Day - " or "Night - " for the next part to function correctly.

The key to all this is, save the files in the attached Zip to a known location, I have mine on a NFS share on my NAS, and edit the switcher.sh file with the path you saved these as and on line 7, which monitor you want. Copy that line for each monitor you want, at some point I want to have this troll all monitors with Day/Night zones, just haven't gotten that far yet. Finally, create a crontab like such

Code: Select all

## Autoswitch the camera zones
*/10 * * * * /nfs/swarm/zoneminder/scripts/switcher.sh 2>&1 | /usr/bin/logger -t switcher
Lot's of room for improvements, including getting the stuff into a GitHub repo for some proper colab.
Attachments
ZMFiles.zip
(18.06 KiB) Downloaded 165 times
Post Reply