HOOTOO HT-IP008HDP PTZ Config

Forum for questions and support relating to the 1.28.x releases only.
Locked
West Slope
Posts: 53
Joined: Wed Jul 15, 2015 12:42 am

HOOTOO HT-IP008HDP PTZ Config

Post by West Slope »

Does anyone have a HOOTOO HT-IP008HDP PTZ, or any HOOTOO PTZ and is the movement working? In the drop down for Control and Onvif and what I'd like to know. Is if ZM is going to Onvif's site to get the files used. If so... It's not working. I have no (Control) movement at all and in the config for my cam comes from Onvif's site as with the pic (Sorry, the board attachment quota has been reached)? Huh? I tried to add and no pic would upload.
Anyway it goes to Onvif's site to get the info for the HOOTOO HT.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: HOOTOO HT-IP008HDP PTZ Config

Post by rockedge »

Hello. I found this code researching getting PTZ controls to work through zoneminder. It has worked on several Foscam clones most recently a Storage Options camera. Is your HooToo a foscam clone? Installed in /usr/share/perl5/ZoneMinder/Control/IPCAM.pm

Code: Select all

# ==========================================================================
#
# ZoneMinder IPCAM Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0001 $
# Copyright (C) 2001-2008 Philip Coombes
# Modified for use with Foscam FI8918W IP Camera by Dave Harris
# Modified Feb 2011 by Howard Durdle (http://durdl.es/x) to:
#      fix horizontal panning, add presets and IR on/off
#      use Control Device field to pass username and password
# Modified June 5th, 2012 by Chris Bagwell to:
#   Rename to IPCAM since its common protocol with wide range of cameras.
#   Work with Logger module instead of Debug module.
#   Fix off-by-1 preset bug.
#   Support optional autostop timeout.
#   Add Zoom, Brightness, and Contrast support.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ==========================================================================
#
# This module contains the implementation of the IPCAM camera control
# protocol.
#
# This is a protocol shared by a wide range of affordable cameras that
# appear to share similar reference design and software.  Examples
# include Foscam, Agasio, Wansview, etc.
#
# The basis for CGI based API can be found on internet by searching for
# "IPCAM CGI SDK 2.1". Here is sample site that also developes replacement
# firmware for some hardware versions.
#
# http://www.openipcam.com/files/Manuals/IPCAM%20CGI%20SDK%202.1.pdf
#
package ZoneMinder::Control::IPCAM;

#use 5.006;
use strict;
use warnings;

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

our $VERSION = $ZoneMinder::Base::VERSION;

# ==========================================================================
#
# IPCAM Control Protocol
#
# ==========================================================================

use ZoneMinder::Logger qw(:all);
use ZoneMinder::Config qw(:all);

use Time::HiRes qw( usleep );

sub new
{
    my $class = shift;
    my $id = shift;
    my $self = ZoneMinder::Control->new( $id );
    my $logindetails = "";
    bless( $self, $class );
    srand( time() );
    return $self;
}

our $AUTOLOAD;

sub AUTOLOAD
{
    my $self = shift;
    my $class = ref($self) || croak( "$self not object" );
    my $name = $AUTOLOAD;
    $name =~ s/.*://;
    if ( exists($self->{$name}) )
    {
	return( $self->{$name} );
    }
    Fatal( "Can't access $name member of object of class $class" );
}

sub open
{
    my $self = shift;

    $self->loadMonitor();

    use LWP::UserAgent;
    $self->{ua} = LWP::UserAgent->new;
    $self->{ua}->agent( "ZoneMinder Control Agent/" . ZoneMinder::Base::ZM_VERSION );

    $self->{state} = 'open';
}

sub close
{
    my $self = shift;
    $self->{state} = 'closed';
}

sub printMsg
{
    my $self = shift;
    my $msg = shift;
    my $msg_len = length($msg);

    Debug( $msg."[".$msg_len."]" );
}

sub sendCmd
{
    my $self = shift;
    my $cmd = shift;
    my $result = undef;
    printMsg( $cmd, "Tx" );

    my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd".$self->{Monitor}->{ControlDevice} );
    my $res = $self->{ua}->request($req);

    if ( $res->is_success )
    {
	$result = $res->decoded_content;
    }
    else
    {
	Error( "Error check failed:'".$res->status_line()."'" );
    }

    return( $result );
}

# Turn IO on (can be internally wired to IR's)
sub wake
{
    my $self = shift;
    Debug( "Wake - IO on" );
    my $cmd = "decoder_control.cgi?command=95&";
    $self->sendCmd( $cmd );
}

# Turn IO off (can be internally wired to IR's)
sub sleep
{
    my $self = shift;
    Debug( "Sleep - IO off" );
    my $cmd = "decoder_control.cgi?command=94&";
    $self->sendCmd( $cmd );
}

sub reset
{
    my $self = shift;
    Debug( "Camera Reset" );
    my $cmd = "reboot.cgi?";
    $self->sendCmd( $cmd );
}

sub moveConUp
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Up" );
    my $cmd = "decoder_control.cgi?command=0&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConDown
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Down" );
    my $cmd = "decoder_control.cgi?command=2&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConRight
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Right" );
    my $cmd = "decoder_control.cgi?command=6&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConLeft
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Left" );
    my $cmd = "decoder_control.cgi?command=4&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConUpLeft
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Diagonally Up Left" );
    my $cmd = "decoder_control.cgi?command=90&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConDownLeft
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Diagonally Down Left" );
    my $cmd = "decoder_control.cgi?command=92&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConUpRight
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Diagonally Up Right" );
    my $cmd = "decoder_control.cgi?command=91&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

sub moveConDownRight
{
    my $self = shift;
    my $params = shift;
    Debug( "Move Diagonally Down Right" );
    my $cmd = "decoder_control.cgi?command=93&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
        $self->moveStop( $params );
    }
}

# command=1 is technically Up Stop but seems to work for all stops.
sub moveStop
{
    my $self = shift;
    Debug( "Move Stop" );
    print("autostop\n");
    my $cmd = "decoder_control.cgi?command=1&";
    $self->sendCmd( $cmd );
}

sub zoomConTele
{
    my $self = shift;
    my $params = shift;
    Debug( "Zoom Tele" );
    my $cmd = "decoder_control.cgi?command=16&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
	$cmd = "decoder_control.cgi?command=17&";
	$self->sendCmd( $cmd );
    }
}

sub zoomConWide
{
    my $self = shift;
    my $params = shift;
    Debug( "Zoom Wide" );
    my $cmd = "decoder_control.cgi?command=18&";
    $self->sendCmd( $cmd );
    my $autostop = $self->getParam( $params, 'autostop', 0 );
    if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
    {
        usleep( $self->{Monitor}->{AutoStopTimeout} );
	$cmd = "decoder_control.cgi?command=19&";
	$self->sendCmd( $cmd );
    }
}

sub zoomConStop
{
    my $self = shift;
    my $params = shift;
    Debug( "Zoom Stop" );
    my $cmd = "decoder_control.cgi?command=17&";
    $self->sendCmd( $cmd );
}

# Increase Brightness
sub irisAbsOpen
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    my $brightness = 100;

    my $cmd = "get_camera_params.cgi?";
    my $resp = $self->sendCmd( $cmd );

    $brightness = int($1) if ( $resp =~ m/var brightness=([0-9]*);/ );
    $brightness += $step;
    $brightness = 255 if ($brightness > 255);
    Debug( "Iris Open $brightness" );
    $cmd = "camera_control.cgi?param=1&value=".$brightness."&";
    $self->sendCmd( $cmd );
}

# Decrease Brightness
sub irisAbsClose
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    my $brightness = 100;

    my $cmd = "get_camera_params.cgi?";
    my $resp = $self->sendCmd( $cmd );

    $brightness = int($1) if ( $resp =~ m/var brightness=([0-9]*);/ );
    $brightness -= $step;
    $brightness = 0 if ($brightness < 0);
    Debug( "Iris Close $brightness" );
    $cmd = "camera_control.cgi?param=1&value=".$brightness."&";
    $self->sendCmd( $cmd );
}

sub whiteAbsIn
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    my $contrast = 5;

    my $cmd = "get_camera_params.cgi?";
    my $resp = $self->sendCmd( $cmd );

    $contrast = int($1) if ( $resp =~ m/var contrast=([0-9]*);/ );
    $contrast += $step;
    $contrast = 6 if ($contrast > 6);
    Debug( "White In $contrast" );
    $cmd = "camera_control.cgi?param=2&value=".$contrast."&";
    $self->sendCmd( $cmd );
}

# Decrease Contrast
sub whiteAbsOut
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    my $contrast = 5;

    my $cmd = "get_camera_params.cgi?";
    my $resp = $self->sendCmd( $cmd );

    $contrast = int($1) if ( $resp =~ m/var contrast=([0-9]*);/ );
    $contrast -= $step;
    $contrast = 0 if ($contrast < 0);
    Debug( "White Out $contrast" );
    $cmd = "camera_control.cgi?param=2&value=".$contrast."&";
    $self->sendCmd( $cmd );
}

sub presetHome
{
    my $self = shift;
    Debug( "Home Preset" );
    my $cmd = "decoder_control.cgi?command=25&";
    $self->sendCmd( $cmd );
}

sub presetSet
{
    my $self = shift;
    my $params = shift;
    my $preset = $self->getParam( $params, 'preset' );
    my $presetCmd = 30 + (($preset-1)*2);
    Debug( "Set Preset $preset with cmd $presetCmd" );
    my $cmd = "decoder_control.cgi?command=$presetCmd&";
    $self->sendCmd( $cmd );
}

sub presetGoto
{
    my $self = shift;
    my $params = shift;
    my $preset = $self->getParam( $params, 'preset' );
    my $presetCmd = 31 + (($preset-1)*2);
    Debug( "Goto Preset $preset with cmd $presetCmd" );
    my $cmd = "decoder_control.cgi?command=$presetCmd&";
    $self->sendCmd( $cmd );
}
1;


hope something helps!
West Slope
Posts: 53
Joined: Wed Jul 15, 2015 12:42 am

Re: HOOTOO HT-IP008HDP PTZ Config

Post by West Slope »

Thanks rockedge,
I'll check it out I have no idea whether it's a clone, or not. I have been working with HootToo's support for the last two weeks, but being from China their being stubborn. I'll try the script you think may work and thank you again, so much!
West Slope
Posts: 53
Joined: Wed Jul 15, 2015 12:42 am

Re: HOOTOO HT-IP008HDP PTZ Config

Post by West Slope »

This was looking good, but overall it turned out to be the same. No movement.
Doing the same here as before.
2015-11-02 14:25:37.233989 zmc_m1 7746 INF IPCAM: 40000 - Capturing at 25.00 fps zm_monitor.cpp 3160

Click to move anything and I get.
2015-11-02 14:27:07.002660 zmcontrol 7821 ERR Error check failed:'500 Can't connect to 1:80 (Invalid argument)' zmcontrol.pl

Then back to.
2015-11-02 14:30:56.952205 zmc_m1 7746 INF IPCAM: 48000 - Capturing at 25.00 fps zm_monitor.cpp 3160

(The Port used by camera) I thought this would be 554. No good. I have 192.168.1.12 The IP of my cam.
Remote Protocol Ffmpeg Couldn’t use the HTTP.
Remote Method Simple
Remote Host Name 192.168.1.12
Remote Host Port No matter what I put here is no good.
Remote Host Path rtsp://admin:admin@192.168.1.12:554/11

Still no good.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: HOOTOO HT-IP008HDP PTZ Config

Post by rockedge »

I have gone through these errors also. It is a good sign, I think your close with this script. The error is your not connecting to the camera.....probably authority issue. I need to look back to see exactly what I did to fix it.

Is the Control tab properly configured for the camera? I had to leave Control Device empty and use as a URL something like this: admin:admin@192.168.12 in Control Address. Then it started working...also be patient for a response from the camera.

Let me know how it goes further.
West Slope
Posts: 53
Joined: Wed Jul 15, 2015 12:42 am

Re: HOOTOO HT-IP008HDP PTZ Config

Post by West Slope »

Thanks for the help rockedge! This has been driving me nuts. I'm on the dark side right now (Windows), but will soon be back to The light side Mint and try what you are saying.
Thanks again...
West Slope
Posts: 53
Joined: Wed Jul 15, 2015 12:42 am

Re: HOOTOO HT-IP008HDP PTZ Config

Post by West Slope »

Did what you said and I got this.
2015-11-02 17:54:39.905402 zmc_m1 3472 ERR Unable to open input 192.168.1.12:554/11 due to: Success zm_ffmpeg_camera.cpp 270
West Slope
Posts: 53
Joined: Wed Jul 15, 2015 12:42 am

Re: HOOTOO HT-IP008HDP PTZ Config

Post by West Slope »

Did what you said again with a bit more and still no movement and no errors this time.
admin:admin@192.168.1.12:554/11
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: HOOTOO HT-IP008HDP PTZ Config

Post by rockedge »

definitely getting there. Is the port the camera is running on correct? Do you have a live video stream? Here is what I did in the Control config ->

Control tab:
Controllable = checked
Control Type = IPCAM
Control Device =
Control Address = admin:admin@192.168.0.15:81 (use your camera's IP and port)
Auto Stop Timeout = 1.00
Track Motion = 0
Return Location = None
Return Delay = 0

this is my config using "edit" of IPCAM,

Main tab
Name = IPCAM
Type = Remote
Can Wake = not checked
Can Sleep = not checked
Can Reset = checked

Move tab
Can Move = checked
Can Move Diagonally = checked
Can Move Mapped = not checked
Can Move Absolute = not checked
Can Move Relative = not checked
Can Move Continuous = checked

Pan tab
Can Pan = checked
Min Pan Range = 0
Max Pan Range = 360
Min Pan Step = 0
Max Pan Step = 360
Has Pan Speed = checked
Min Pan Speed = 0
Max Pan Speed = 4
Has Turbo Pan = not checked
Turbo Pan Speed = 0

Tilt tab
Can Tilt = checked
Min Tilt Range = 0
Max Tilt Range = 90
Min Tilt Step = 0
Max Tilt Step = 90
Has Tilt Speed = checked
Min Tilt Speed = 0
Max Tilt Speed = 4
Has Turbo Tilt = not checked
Turbo Tilt Speed = 0

All the rest I left as default. Of course these settings may vary for your camera somewhat but this may help get the PTZ going. I saved everything, tested the camera and it works.
Locked