Skip to content

Commit

Permalink
Only set channel from the default (1) if ControlDevice is populated
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Aug 8, 2023
1 parent 1e200ab commit 769f6ce
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Debug("Have " . $+{PASSWORD});
# Save the base url
$self->{BaseURL} = "http://$host:$port";

$ChannelID = $self->{Monitor}{ControlDevice};
$ChannelID = $self->{Monitor}{ControlDevice} if $self->{Monitor}{ControlDevice};
$realm = '';

if (defined($user)) {
Expand Down Expand Up @@ -194,7 +194,7 @@ sub PutCmd {
Error("No cmd specified in PutCmd");
return;
}
Debug("Put: $cmd to ".$self->{BaseURL});
Debug("Put: $cmd to ".$self->{BaseURL}.(defined($content)?' content:'.$content:''));
my $req = HTTP::Request->new(PUT => $self->{BaseURL}.'/'.$cmd);
if ( defined($content) ) {
$req->content_type('application/x-www-form-urlencoded; charset=UTF-8');
Expand Down Expand Up @@ -274,11 +274,10 @@ sub moveVector {
# Change from microseconds to milliseconds
$duration = int($duration/1000);
my $momentxml;
if( $duration ) {
if ($duration) {
$momentxml = "<Momentary><duration>$duration</duration></Momentary>";
$command = "ISAPI/PTZCtrl/channels/$ChannelID/momentary";
}
else {
} else {
$momentxml = '';
$command = "ISAPI/PTZCtrl/channels/$ChannelID/continuous";
}
Expand Down

0 comments on commit 769f6ce

Please sign in to comment.