Probable bug? Saving Run States

Support and queries relating to all previous versions of ZoneMinder
Locked
hid
Posts: 1
Joined: Tue Feb 07, 2006 1:24 am

Probable bug? Saving Run States

Post by hid »

HI all,

with zoneminder 1.22.x i'm experiencing a probable bug...

if i save the current running state, ZM save only the id and the function state in the db, and not the enabled state...

to make things working i must enter the mysql database and add the enabled state to 1 in the states table...

for example, after a click on save sate from the PHP GUI, the entry in the DB are the following:

Name Definition
Day 1:Modect:,2:Monitor:
Night 1:Modect:,2:Modect:

i must edit the record and change it to:

Name Definition
Day 1:Modect:1,2:Monitor:1
Night 1:Modect:1,2:Modect:1

to make things working....

Best Regards
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for reporting this. I'll take a look and check.
Phil
majik-br
Posts: 17
Joined: Mon Sep 19, 2005 12:46 pm
Location: Sao Paulo, Brazil

Post by majik-br »

I have just replicated this situation and it's exactly as described.

BTW, something else happens in this scenario:

Changing run state to a 'saved state' while monitors are in a previously disabled state won't enable them - even when the states table is corrected the way proposed.

The other way around however will work (i.e, monitors are in a previously enabled state and the states table isn't corrected after saving - 'not-enabled' monitors in states table, this will disable the monitors).

It's like zmpkg.pl has a "running-state-disabled priority" in changing states. If the monitors currently running state is disabled, changing them to a enabled saved state will not enable them, while the other way works.
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Replicated too, and it's quite an annoying problem.

With 5 cameras I was able to tweak the table with sql, but now I've added another I'm having big problems.

All i did was Save the new State for my "Night" setting and it broke the previous one as indicated, but even stopping zm, fixing the lines in phpmyadmin to read

1:Modect:1,2:Modect:1,8:Modect:1,9:Modect:1,10:Modect:1,11:Modect:1

Means all cameras are set to not-enabled when "zmpkg night" is called to change states.

Is there a patch I can apply to fix it until the next version? Adding/removing states is a huge nightmare now!
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

This is a very trivial fix, patch below.

Code: Select all

--- zm_actions.php      24 Jan 2006 10:06:34 -0000      1.93
+++ zm_actions.php      8 Feb 2006 12:24:52 -0000       1.94
@@ -1608,7 +1608,7 @@
                {
                        if ( $run_state || $new_state )
                        {
-                               $sql = "select Id,Function from Monitors order by Id";
+                               $sql = "select Id,Function,Enabled from Monitors order by Id";
                                $result = mysql_query( $sql );
                                if ( !$result )
                                        die( mysql_error() );
Though the line numbering may be different in your version as other changes has also gone in. basically just add the ",Enabled" bit to the sql query in zm-actions.php
Phil
gola10
Posts: 150
Joined: Wed Nov 01, 2006 3:16 pm
Location: Panama

Possible bug

Post by gola10 »

I am running version 1.22.3 on Mandriva 2007 installed from RPM.

I has created two new states "dia" and "noche" (which means "day" and "night" in Spanish.)
and has 4 cameras but declared 8 monitors. 4 with day setting and 4 with night setting. This was suggested to me in this forum as a way to have different setting for day and night.

I checked the States databases with webmin and this is what i have.
dia 1:Record:1,2:Record:1,3:Record:1,4:Record:1,5:None:0,6:None:0,7:None:0,8:None:0
noche 1:None:0,2:None:0,3:None:0,4:None:0,5:Modect:1,6:Modect:1,7:Modect:1,8:Modect:1

When i apply the "dia" state or the "noche" state, the Function field in the Monitors database is updated correctly but the Enabled field is always set =0 on all monitors permanently and this can be seen with Webmin on the monitors database.
This suggest to me that when i change of state (day or night) the enable field is not updated.
Now i have 8 monitors all dissabled.

More information. I enabled all 8 monitors and Applied Dia state. Result is correct. Monitor 1 thru 4 are enabled and 5 thru8 dissabled.
Now applied Noche state. Result incorrect because now all 8 monitors are dissabled.
So if monitor is enabled it is disabled is asked for it but if a monitor is disabled it is not enabled is asked to set enabled.
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

gola10 can you check if you are using the latest RPM. It is zm-1.22.3-6mdv2007.0

I just checked this here and it's working correctly. If you need to upgrade just install with rpm -Uvh and then you will need to restart zm.
gola10
Posts: 150
Joined: Wed Nov 01, 2006 3:16 pm
Location: Panama

Post by gola10 »

i just checked and this is the RPM i used. zm-1.22.3-6mdv2007.0.i686.rpm

What is happening on my installation is that if the monitor is disabled (0) it would not be enabled when applying a state that is supposed to enable it.
Since i am trying to have different settings for Day and Night, i has created each monitor twice. Maybe this is why i am having this problem. Should i give a unique name to each monitor?
On the status command there is no monitor name but monitor number and that is why i thought that i could create twice a minitor with the same name and pointing to the same "/dev/".

Now i am confused.
User avatar
tmasman
Posts: 2
Joined: Fri Nov 16, 2007 4:44 pm

Same issue compiling from source in 1.22.3 in Ubuntu...

Post by tmasman »

I'm running Ubuntu Dapper...
Installed ZM 1.22.3 From source (followed the guide in the Wiki)

It's working fine with the 1 camera I have right now (plan to have 10-16 eventually). I can save States and see them listed in the "States' table in the db. However, when I "apply" one of these states, the monitor (camera) does update it's function.

Is there something I'm missing? Do I need to apply the patch listed above? Edit: The patch listed above is already in place... That's not the issue...

Like I said, the States are saved in the db properly with the monitor ID, function, & enabled (1), but when I click on "Running" in the UI, then select a state & click apply, nothing changes (the function does not update for the monitor).

Please advise.
Thanks in advance.

- Thomas
Haltom City, TX
overly
Posts: 36
Joined: Mon Aug 20, 2007 6:14 pm
Location: Cleveland, Ohio USA

Re: Same issue compiling from source in 1.22.3 in Ubuntu...

Post by overly »

tmasman wrote:I'm running Ubuntu Dapper...
Installed ZM 1.22.3 From source (followed the guide in the Wiki)

It's working fine with the 1 camera I have right now (plan to have 10-16 eventually). I can save States and see them listed in the "States' table in the db. However, when I "apply" one of these states, the monitor (camera) does update it's function.

Is there something I'm missing? Do I need to apply the patch listed above? Edit: The patch listed above is already in place... That's not the issue...

Like I said, the States are saved in the db properly with the monitor ID, function, & enabled (1), but when I click on "Running" in the UI, then select a state & click apply, nothing changes (the function does not update for the monitor).

Please advise.
Thanks in advance.

- Thomas
Haltom City, TX
I've stumbled upon the same problem. I've tried to narrow it down and have found that using zmpkg.pl "custom state> works, however changing the run state via the web interface doesn't. The web interface does work for the default "Run" and "Stop" states, but not for any custom states.

In case it matters I'm running 1.23.0-RC3.
User avatar
tmasman
Posts: 2
Joined: Fri Nov 16, 2007 4:44 pm

Re: Same issue compiling from source in 1.22.3 in Ubuntu...

Post by tmasman »

overly wrote: I've stumbled upon the same problem. I've tried to narrow it down and have found that using zmpkg.pl "custom state> works, however changing the run state via the web interface doesn't. The web interface does work for the default "Run" and "Stop" states, but not for any custom states.

In case it matters I'm running 1.23.0-RC3.
Thank you! I didn't even think to try the command-line method since the web interface wasn't taking care of business. I'll give that a try tomorrow.

- Thomas
Locked