From 769f6ce372f862c517ac9fb789d2576a0ebf5905 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Aug 2023 13:28:18 -0400 Subject: [PATCH] Only set channel from the default (1) if ControlDevice is populated --- scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm index b8f730c833..ec096ec21f 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm @@ -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)) { @@ -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'); @@ -274,11 +274,10 @@ sub moveVector { # Change from microseconds to milliseconds $duration = int($duration/1000); my $momentxml; - if( $duration ) { + if ($duration) { $momentxml = "$duration"; $command = "ISAPI/PTZCtrl/channels/$ChannelID/momentary"; - } - else { + } else { $momentxml = ''; $command = "ISAPI/PTZCtrl/channels/$ChannelID/continuous"; }