Page 1 of 1

Disable some zones at different time

Posted: Tue Jun 07, 2011 6:55 am
by gilles
Hi All,

I'm very pleased to discover zoneminder.

I use zoneminder 1.24.2 on ubuntu 10.4.2 server and I have a 7130 vivotek connected by ip.

I would like to disable some detection zones on different hour. I do some save run state but it seems like run state don't save the changing state of a zone.


To be clear when it's 8h00 I want my active zone A and B to be active and when it's 12h00 I wonder my zone A not to be active and my zone B Active.


Is it possible to do that ?

I Hope it is.

If you've got the answer, I listen you, please.

Thank you.

Gilles.

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 8:21 am
by gilles
Hi,

No answer ?

nobody have got an Idea ?

Gilles

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 11:48 am
by mastertheknife
If you know can script, then here is a rough guide:

1) kill zmwatch.pl
2) Stop the zma daemon for that monitor by calling zmdc.pl stop zma -m 1
(change -m 1 to the correct monitor ID)
3) Edit the database to disable\enable the zones
4) Restart the zma daemon by calling zmdc.pl start zma -m 1


mastertheknife.

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 12:03 pm
by gilles
Hi ,

Thank you for your suggestion, If I don't find anything, I will try to script that.
Don't you think there is an other soft solution ? (by soft, I mean make no kill process).

Gilles.

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 12:19 pm
by cordel
There is currently no other method really available.

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 1:32 pm
by gilles
So If I'm not wrong,

I can stop zm then update my database by changing my value to Inactive and then restart, No ?

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 1:41 pm
by mastertheknife
gilles wrote:So If I'm not wrong,

I can stop zm then update my database by changing my value to Inactive and then restart, No ?
Exactly. You don't have to fully stop ZM, just zma for the corresponding monitor.

mastertheknife

[SOLVED] Disable some zones at different time

Posted: Thu Jun 09, 2011 1:55 pm
by gilles
Thank you to mastertheknife and Cordel.

I just have to make my script and that's OK.

So my problem is solved.

Gilles

Re: Disable some zones at different time

Posted: Thu Jun 09, 2011 4:08 pm
by algenon
hi gilles,

how did you get ZM to read the 7130 vivotek's MPEG video stream?

Algenon

Re: Disable some zones at different time

Posted: Fri Jun 17, 2011 9:54 am
by gilles
Hi Algenon,

I'm sorry for my later answer but I was sick last time.

I make a mistake about my ip camera this is a vivotek 7330 and not a 7130. And I use JPEG as MJEPG doesn't work (but I didn' last time on that)

It works very well, but I can't use the MJPEG which is best than JPEG, I think (but not sure).

If you want more informations, open a new post and I will answer what I know.

Gilles.

Re: Disable some zones at different time

Posted: Wed Jul 20, 2011 3:30 am
by wdeninger
So does anyone know how one disable a zone? (NOTE: Setting a zone to Inactive does NOT disable it. An Inactive zone only suppresses all other Zone events within the region)..

I suppose I can try a little math trick with the MonitorID, but that's a really ugly solution.

-W

Re: Disable some zones at different time

Posted: Wed Jul 20, 2011 5:55 am
by PacoLM
Isn't better just duplicate the monitor with different zones and then enable the desired monitor according the time, save a state, then do a cron job to the state??.

PacoLM

Re: Disable some zones at different time

Posted: Wed Jul 20, 2011 8:20 am
by wdeninger
Keeping the zones associated with a single monitor does have some advantages, like keeping all the data referenced by region together. I simply added suffixes to the zone names (e.g. day/night), and execute a corresponding script in my crontab. That way, I could easily build onto it without needing scripting changes. Also, it gives me flexibility to create zones that are persistent all the time (not having day/night in the name). For instance, My zones are:

+----------------------------+-----------+
| Name | MonitorId |
+----------------------------+-----------+
| Driveway-day | 101 |
| Frontyard-1-day | 102 |
| Frontyard-2-day | 103 |
| Bedroom-side-day | 104 |
| Garage-side-day | 105 |
| Backyard-1-day | 106 |
| Backyard-2-day | 107 |
| Front-door-day | 103 |
| Bedroom-side-night | 4 |
| Garage-side-night | 5 |
| Backyard-1-night | 6 |
| Backyard-2-night | 7 |
| Frontyard-2-night | 3 |
| Frontyard-1A-night | 2 |
| Driveway-night | 1 |
| Frontyard-2-inactive-night | 3 |
| Frontyard-1B-night | 2 |
+----------------------------+-----------+

my crontab looks like:

# at 6 am... shift to day parameters
00 06 * * * /root/zone-day.ksh >> /root/zone-update.log
# at 9pm... shift to night parameters
00 21 * * * /root/zone-night.ksh >> /root/zone-update.log

where zone-day.ksh is:

#!/bin/bash
# zone-day.ksh
/root/zone-monitor-modify.ksh +100 night
/root/zone-monitor-modify.ksh -100 day
/root/zone-update.ksh

#!/bin/bash
# zone-night.ksh
/root/zone-monitor-modify.ksh +100 day
/root/zone-monitor-modify.ksh -100 night
/root/zone-update.ksh


#!/bin/bash
# zone-monitorid-modify.ksh
mysql -e "use zm; update Zones set MonitorID=MonitorID+'$1' where Name LIKE '%$2';"

and obviously

#!/bin/bash
# zone-update.ksh
zmu -m 0 -L -U username -P password
zmu -m 1 -L -U username -P password
zmu -m 2 -L -U username -P password
zmu -m 3 -L -U username -P password
zmu -m 4 -L -U username -P password
zmu -m 5 -L -U username -P password
zmu -m 6 -L -U username -P password
zmu -m 7 -L -U username -P password