Questions about 'states'

Forum for questions and support relating to the 1.29.x releases only.
Locked
Tantamount
Posts: 76
Joined: Wed Feb 03, 2016 7:51 am

Questions about 'states'

Post by Tantamount »

Can different states contain different zones? It seems like whenever I switch zones from the console, it overwrites the zones I had created for a different state. I'm not sure if this is because I may have accidentally clicked "save" instead of "apply" after selecting the different state or not.

To change states in the web gui console, I just have to select the different state name and choose "apply" correct?

If I edit a zone, does it automatically save in the state I am currently in, or do I have to "save" it?

If I reboot the server that is hosting zm, when it starts back up, will it choose the last state it was in, or will it go back to "default"? If it does stay put, is it okay to delete the "default" state?
3 ReoLink RLC-410
2 Annke NC800
Kubernetes 1.22.6 statefulset of 5 Ubuntu 20.04 pods using iconnor's repository
ZoneMinder Version 1.36.12
Tantamount
Posts: 76
Joined: Wed Feb 03, 2016 7:51 am

Re: Questions about 'states'

Post by Tantamount »

Anyone?
3 ReoLink RLC-410
2 Annke NC800
Kubernetes 1.22.6 statefulset of 5 Ubuntu 20.04 pods using iconnor's repository
ZoneMinder Version 1.36.12
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Questions about 'states'

Post by knight-of-ni »

Never tried it, but I don't think it does. The zone information is in its own dB table, which is not part of the information that is "remembered" by each state.

To work around this, try creating two monitors for the same camera, which are identical, except for the motion zones.
Enable the first monitor and disable the second monitor in the first state. Reverse that for the second state.

ZoneMinder is supposed to return to the last state it was in after a restart/reboot in the latest version of ZoneMinder.
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/
Tantamount
Posts: 76
Joined: Wed Feb 03, 2016 7:51 am

Re: Questions about 'states'

Post by Tantamount »

Thanks for the reply knnniggett.

So the "state" information is only the configuration options under "Source" for each monitor, and maybe the settings under "Options" for the entire system?
3 ReoLink RLC-410
2 Annke NC800
Kubernetes 1.22.6 statefulset of 5 Ubuntu 20.04 pods using iconnor's repository
ZoneMinder Version 1.36.12
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Questions about 'states'

Post by knight-of-ni »

What gets saved in a State is from the Monitors table (only) so that would just be each Monitor configuration.
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/
jtech
Posts: 13
Joined: Thu Feb 04, 2016 5:37 pm

Re: Questions about 'states'

Post by jtech »

I believe the Zone information is linked to each particular Monitor.

When I wanted to have two different zones settings, I had to create two monitors for the same camera to adjust the zone settings, and then have two different States (Daytime, and Night) setup to apply those settings. You can probably use "default" as the daytime settings.

I had a "Front" monitor for that camera, with zones setup for daytime.
Then I created a "Front-Night" monitor for the same camera with different zone settings to so that I could exclude some problematic light sources that were causing alarms all the time.

After creating the different monitors, you'll have to setup the exact settings you want for save in a particular State.

Eg. To save the Daytime (or default) state:
- Disable the "Front-Night" monitor by setting the "Function" to "None" and have the regular "Front" monitor enabled (eg set function to Modect) and setup how you'd like it.
- Then go to the run states and select "default" from the dropdown and hit "Save".

If you want to make a change, come back re-select "default" and hit 'Save' again to update that state.
Note: Hitting "Apply" will simply retrieve the that saved state's information and apply it to your monitors. (it won't save anything)

Then repeat for your "Night" state:

- Disable the "Front" monitor by setting the "Function" to "None" and have the "Front-Night" monitor enabled (eg set function to Modect) and setup how you'd like it.
- Then go to the run states and enter "Night" into the box and hit "Save".

If you want to make a change for that Night state change things then come back re-select "Night" from the dropdown and hit 'Save' again to update that state.

If you want this to work automatically to switch between day and night, you'll have to setup a cron job to apply the states to Zoneminder.

I setup this under /etc/crontab a few years ago.

The following switches the state to Daytime at 7am, then at 7:02am it restarts zoneminder to have it correctly apply the state.
(I'm not sure if the restart is still required, but it works)
Then at 17 (5pm) it switches to "Night" state and then at 5:02pm it restarts zoneminder to apply that state correctly as well.

Eg. Add the following after any other system stuff in /etc/crontab
Note: if using the 'default' state name instead of "Daytime" replace any instances of "Daytime" below with "default".

Code: Select all

# Zoneminder - Switch between different states
# m h dom mon dow user  command
0 7     * * *   root    /usr/bin/zmpkg.pl Daytime
2 7     * * *   root    /usr/bin/zmpkg.pl restart
0 17    * * *   root    /usr/bin/zmpkg.pl Night
2 17    * * *   root    /usr/bin/zmpkg.pl restart
#
Edit: added note about setting function to None to properly disable a Monitor.
Last edited by jtech on Tue Feb 23, 2016 7:09 pm, edited 1 time in total.
Tantamount
Posts: 76
Joined: Wed Feb 03, 2016 7:51 am

Re: Questions about 'states'

Post by Tantamount »

Thanks jtech.

Others have mentioned creating duplicate monitors to solve other issues too. I'll have to investigate this further... Does that increase cpu usage? I remember setting up monitors before and disabling them, yet I saw zmc processes that weren't 0% utilization.

I'm thinking that fancy new API may be helpful here too -- where I can create and destroy zones depending on events like day/night, but perhaps even based on presence.
3 ReoLink RLC-410
2 Annke NC800
Kubernetes 1.22.6 statefulset of 5 Ubuntu 20.04 pods using iconnor's repository
ZoneMinder Version 1.36.12
jtech
Posts: 13
Joined: Thu Feb 04, 2016 5:37 pm

Re: Questions about 'states'

Post by jtech »

Hi Tantamount,

It looks like if you have duplicate monitors that are not in use, change their "Function" to "None" before you save your state.

I just checked, and if I leave a Monitor to "Modect" but set it to "Enabled -> Unchecked" (ie disabled) then there are still /usr/bin/zma and /usr/bin/zmc processes associated with that monitor running.

(not sure if that's a bug? or I guess it still allows you to do a live view but will just not check for motion detection)

So you must set the "Function" to "None", and then that monitor will not show up in the process listing.
Locked