I try setup simple day/night states with one monitor with ZoneMinder 1.22.3. I create monitor with function Modect and two states: Night with disabled and Day with enabled. Save this states works fine and in MySQL I can check it's all right.
Changing state from Day to Night corectly disable function. But Night to Day do not work right and Modect function not enabled.
In zmpkg.pl I found:
Code: Select all
113 while( my $monitor = $sth->fetchrow_hashref() )
114 {
115 foreach my $definition ( @{$state->{Definitions}} )
116 {
117 if ( $monitor->{Id} =~ /^$definition->{Id}$/ )
118 {
119 $monitor->{NewFunction} = $definition->{Function};
120 $monitor->{NewEnabled} = $definition->{Enabled};
121 }
122 }
123 #next if ( !$monitor->{NewFunction} );
124 $monitor->{NewFunction} = 'None' if ( !$monitor->{NewFunction} );
125 $monitor->{NewEnabled} = 0 if ( !$monitor->{Enabled} );
126 if ( $monitor->{Function} ne $monitor->{NewFunction} || $monitor->{Enabled} ne $monitor->{NewEnabled} )
127 {
128 my $sql = "update Monitors set Function = ?, Enabled = ? where Id = ?";
129 my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
130 my $res = $sth->execute( $monitor->{NewFunction}, $monitor->{NewEnabled}, $monitor->{Id} ) or Fatal( "Can't execute: ".$sth->errstr() );
131 }
132 }