calendar/time support enabling scheduleling when camera is on/off

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
ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

calendar/time support enabling scheduleling when camera is on/off

Post by ghostwolf59 » Fri May 29, 2020 7:49 am

Im probably not the first one asking for this, but its such an obvious thing to add.

Rather than monitor all the time, it would be a great feature if all or selected cameras could be turned on/off based on time of day.
It could also be useful to extend this feature to include a calender where specific dates along with time could be managed.

Only way I found so far is to set up a cron task that in effect stop or start zm based on my cron schedule.
This works, but would in effect affect all(!) cameras - for me it doesnt really matter, but I can see situations where only a selected few cameras should continue or stop monitoring.

Another feature request is to include a proper email setup with(!) a test email sendout - its silly being forced to configure email and then force an event *that in effect force me to go to a different page* and see if the mail is sent.
Could have been easy enough to include something similar to how for example NextCloud offer its email setup - same page and you can simply click "test email" - if it doesnt work, then I havent moved from the setup page in question and can simply make tweak and test it again.

mikb
Posts: 459
Joined: Mon Mar 25, 2013 12:34 pm

Re: calendar/time support enabling scheduleling when camera is on/off

Post by mikb » Fri May 29, 2020 3:11 pm

ghostwolf59 wrote:
Fri May 29, 2020 7:49 am
great feature if all or selected cameras could be turned on/off based on time of day.

Only way I found so far is to set up a cron task that in effect stop or start zm based on my cron schedule.
There is a way to do this, you've nearly got it already.

Instead of accepting the default "run states" of just start and stop you can create your own states and within those states, enable/disable cameras. Then from cron you can do your zmpkg.pl [state] to enable the set of cameras you want, instead of a blunt start/stop.

Note that last entry in this usage hint ...

Code: Select all

root@perkin:~# zmpkg.pl 
Usage: zmpkg.pl <start|stop|restart|status|logrot|'state'>

ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

Re: calendar/time support enabling scheduleling when camera is on/off

Post by ghostwolf59 » Sat May 30, 2020 5:58 am

I read a post outlining these modes (Daytime/Nighttime), but the way I see it, these modes just replaces the start/stop states anyways.
Example:
Daytime state associated with Stop state
Nighttime state associated with Start state

Setting up a cron task to schedule these new states
# minute (0-59),
# | hour (0-23),
# | | day of the month (1-31),
# | | | month of the year (1-12),
# | | | | day of the week (0-6 with 0=Sunday).
# | | | | | commands
# Daytime active 6am in the morning all days year around
# Nighttime active 23:30am all days year around
# In effect camera would be changing state 6am and again 23:30am
0 6 * * * root /usr/local/bin/zmpkg.pl Daytime
30 23 * * * root /usr/local/bin/zmpkg.pl Nighttime

This is nothing but a Start/Stop state

But in saying that, when I setup new states as above and from a Run state manually select the Daytime state, it still runs and camera continue to capture and record movements.
But when I select the Default state the server is still running, but the camera is disabled. - Seem to be what I want, but the Daytime associated with Stop state always make it active and recording - weird ???

So perhaps I need to use the Nghttime (that activates the camera) and Default that disables the camera in question - So far I only have one camera to play with, so no idea how this would work or affect other cameras if I had it installed *like plan is down the track* ;)



What am I missing here?

Havent found any settings that allow me to control individual cameras State

Btw.
If you know how to resolve the email notification on triggered event, then it would be appreciated - Really struggling getting this to work.
Have setup and configured postfix, that works perfectly from command line, but nothing is sent out from zm.
Config -> Email configured, yet nothing

mikb
Posts: 459
Joined: Mon Mar 25, 2013 12:34 pm

Re: calendar/time support enabling scheduleling when camera is on/off

Post by mikb » Sat May 30, 2020 4:28 pm

ghostwolf59 wrote:
Sat May 30, 2020 5:58 am
... but the way I see it, these modes just replaces the start/stop states anyways.
Then there would be no point having "states" if they are just other ways of saying start and stop.

The normal "start -> running" state and "stop -> stopped" state are in addition to any you define, not instead of, or renaming of.
ghostwolf59 wrote:
Sat May 30, 2020 5:58 am
Havent found any settings that allow me to control individual cameras State
You enable/disable the individual cameras in the usual way (Set them to Off/Mocord/Modect/Record etc.) but you do that within the state you created.

These settings then should carry over when you change states.

ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

Re: calendar/time support enabling scheduleling when camera is on/off

Post by ghostwolf59 » Sun May 31, 2020 4:59 am

mikb wrote:
Sat May 30, 2020 4:28 pm
Then there would be no point having "states" if they are just other ways of saying start and stop.
Agree, hence confused about the whole "feature" :shock: :?:

It seem to work somehow though, but I only manage this by using "Nighttime" (run state that change the cameras mode to "Modect" ) (that in effect activates the camera where it starts capturing movement) and "default" that changes the cameras state from "Modect" to "disabled".

When I use the "Daytime" run state where I expect the camera to do what I described as the "default" state above, the camera dont change and just sets it in a "Modect" "Capturing" state.

You enable/disable the individual cameras in the usual way (Set them to Off/Mocord/Modect/Record etc.) but you do that within the state you created.

These settings then should carry over when you change states.
Im sure this makes perfect sense to you, but I have no idea how this actually could be controlled across cameras???

Lets say I set a camera state to "Modect", should I "check" the camera in question (check box on the right side) and then add a run state i.e Nighttime/Daytime state, and once state have been defines, change the cameras mode to "None" and again check (check box) followed by defining a new state or...?

Really confused with how this is intended to work?

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests