Foscam FI8908W IP Camera with PT (no Z) Working in ZM 1.24.2

Post here to indicate any hardware you have used and which is known to work with ZoneMinder. Not for questions.
mbrinkho
Posts: 9
Joined: Thu Feb 25, 2010 1:39 am

Post by mbrinkho »

Do I send those commands to the camera or the zoneminder?
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Post by PacoLM »

Hi,

Did you enabled the OPT_CONTROL setting in the Options:System?.

If so, follow the steps that Dave provided, it works, for sure!.

Regards,

PacoLM
user888
Posts: 13
Joined: Wed Apr 28, 2010 6:48 am

Post by user888 »

I'm having a hard time to get it running.. To debug it I try to run it from the commandline:

/usr/bin/zmcontrol.pl --id=9 --command=moveConDown

It fails with:
Can't connect: Connection refused at /usr/lib/perl5/vendor_perl/5.10.0/ZoneMinder/Debug.pm line 349
ZoneMinder::Debug::Fatal('Can\'t connect: Connection refused') called at /usr/bin/zmcontrol.pl line 158

I would like to get it running and extend the script with preset locations (approximately with timed moves), brightness and contrast controls, mirroring etc.

update: still haven't got it running, but my PID file was corrupted. I had a line...

$ENV{LD_PRELOAD} = '/usr/lib/libv4l/v4l2convert.so';

...added to my zmdc.pl file for a usb webcam, this caused the pid file to contain:

Code: Select all

19863ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/usr/lib/libv4l/v4l2convert.so' from LD_PRELOAD cannot be preloaded: ignored.
;-) Still doesn't solve my problems

Update: Got it working. Hint: zmcontrol.pl keeps running, when making changes in the script first do a killall zmcontrol.pl.

I'm working on an updated version of the script.
mbrinkho
Posts: 9
Joined: Thu Feb 25, 2010 1:39 am

Post by mbrinkho »

PacoLM wrote:Did you enabled the OPT_CONTROL setting in the Options:System?.
I did enable that and it made the "control" tab show up. This is what mine looks like now.

Image
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Post by PacoLM »

You need to put the control address, I think.
mbrinkho
Posts: 9
Joined: Thu Feb 25, 2010 1:39 am

Post by mbrinkho »

PacoLM wrote:You need to put the control address, I think.
I tried that with the IP address of the camera but the results were the same.
user888
Posts: 13
Joined: Wed Apr 28, 2010 6:48 am

Post by user888 »

Put the IP-address of your camera in the 'control address field'.

Have you editted all name/password entries in the .pm file?

Diagnosing:
First try to execute the control command from the commandline. For example:

/usr/bin/zmcontrol.pl --id=1 --command=moveConUp

Where 1 = your monitor ID. If something is wrong it probably says so on standard out. Also check the zmcontrol.log

If you see something like:

Code: Select all

Can't connect: No such file or directory at /usr/lib/perl5/vendor_perl/5.10.0/ZoneMinder/Debug.pm line 349
	ZoneMinder::Debug::Fatal('Can\'t connect: No such file or directory') called at /usr/bin/zmcontrol.pl line 154
or

Code: Select all

Can't connect: Connection refused at /usr/lib/perl5/vendor_perl/5.10.0/ZoneMinder/Debug.pm line 349
ZoneMinder::Debug::Fatal('Can\'t connect: Connection refused') called at /usr/bin/zmcontrol.pl line 158
...
Then first do a killall -9 zmcontrol.pl

Then select the 'Panasonic IP' control type
Execute /usr/bin/zmcontrol.pl --id=1 --command=moveConUp again
It won't move your camera, but if zmcontrol.pl doesn't report anything, the problem is most probably in your 'Foscam FI8908W.pm' script

Best way is to use the 'Panasonic IP.pm' script and start over again: copy everything from the Foscam script, line by line. After every change to the script killall zmcontrol.pl!

Some other hints
Check if your /var/run/zm/zm.pid contains the correct process id (try restarting zm). And check if /var/run/control socket files exist (I forgot the correct names, because I now also have problems with it ;-))
To check your script, try:

Code: Select all

perl /usr/lib/perl5/vendor_perl/5.10.0/ZoneMinder/Control/FoscamFI8908W.pm
mbrinkho
Posts: 9
Joined: Thu Feb 25, 2010 1:39 am

Post by mbrinkho »

Managed to get it working earlier today. The fixing change was adding the IP address of the camera to the "Control Address" field in the camera settings. The KEY is running

killall -9 zmcontrol.pl

EVERY time you make a change to see if it is working!

Of course after I got it working by running the script manually I ran into the "can't bind: address already in use" error but that was quickly fixed with the link below.

http://www.zoneminder.com/forums/viewto ... 425a008d13

Thanks for all of the help!
capof
Posts: 4
Joined: Sun Sep 20, 2009 4:52 pm

Post by capof »

First i 'd like to thank the autor of the topic witch was very helpfull !

I was able to make work my foscam at the first time.

Just two little thing to solve.

- pan and tilt comand make move the camera until i hit the central control buton. in the foscam website, camera stop moving immediately when i stop to hit control buton. I d like to have the same in zm.

- how to reduce the streaming delay. zm picture arrive about 15 seconde later as the reality. that mean, when i hit a control comand, i have to wait 15 to see the new position. how to reduce this delay ?

thx

Chris.
daveharris
Posts: 25
Joined: Mon Oct 26, 2009 2:47 pm

Post by daveharris »

Good work mbrinkho, some stuff there i wasn’t aware of, learn something new every day! :)

Chris, my setup is like yours and keeps panning/tilting until the stop command is sent, i actually preferred it this way and so haven’t looked to change it. I guess you could alter the Perl script to auto send a stop command after each move and make it more like the ipcamera site, but i haven’t tried this.

I also have a delay, but only around 1 - 1.5 seconds, which can make the panning/tilting a bit tricky sometimes. there could be a few factors for this if they are wireless cameras there will be a slight lag, if your machine is also wireless there would be a bit more lag. I would suspect that the computer would be the main reason for it being slow or network congestion, although this is a guess. I wonder if anyone else suffers from similar delays?
capof
Posts: 4
Joined: Sun Sep 20, 2009 4:52 pm

Post by capof »

Hi dave, and thank for your answer.

I will try to modify perl script like you say... it's a good idea. In fact i was wondering, if if the way the camera still move was normal...

For the delay question, it's correct when i connect from my lan.

I had not precised it in my previous post, if i connect with my internet connection, i have about 10 to 15s delay.
daveharris
Posts: 25
Joined: Mon Oct 26, 2009 2:47 pm

Post by daveharris »

If I VPN in from work, i probably get about a 3-4 second delay, depending on traffic. You could possbily lower the frame rate and resolution to try and combat this delay?

My system is offline atm whilst I do some work on fitting the cameras in more permanent positions, although im undecided where they are going so its not going to well lol :)

Let me know how you get on though. Cheers :)
eggplant37
Posts: 3
Joined: Tue Jun 15, 2010 12:07 am
Location: Warren, MI

Revision for HooToo IPCam

Post by eggplant37 »

OK, so I didn't do my research terribly well and got stuck with a couple of these Foscam clones sold by an outfit known as HooToo.com. I had some trouble figuring out how to get the PT(no Z) controls to work with this camera. I initially used the scripts that Phillip Combes had posted without too much luck. I then invited some help from a programmer friend of mine, Steve Campbell. Here's what he came up with:

Code: Select all

# ==========================================================================
#
# ZoneMinder HooToo IP Camera Control Protocol Module
# Copyright (C) 2010  Steven M Campbell
#
# 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 HooToo IP camera control
# protocol.  It was adapted from control protocol's written by Phillip Combes.
#

package ZoneMinder::Control::HooTooIPCam;

use 5.006;
use strict;
use warnings;

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

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

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

# ==========================================================================
#
# HooTooIPCam Control Protocol
#
# ==========================================================================

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



sub new {
  my $class = shift;
  my $id = shift;
  my $self = ZoneMinder::Control->new( $id );

  Debug( "Camera New" );
  bless( $self, $class );
  return $self;
}



our $AUTOLOAD;

sub AUTOLOAD {
  my $self = shift;
  my $class = ref($self) || croak( "$self not object" );
  my $name = $AUTOLOAD;
  Debug( "Camera AUTOLOAD" );

  $name =~ s/.*://;
  if ( exists($self->{$name}) ) {
    return( $self->{$name} );
  }

#  You can change the user and password here for all control commands

  my $user = "admin";
  my $pwd = "";

#  The basic decoder_control url just to make the below commands table easy 
#  to read 

  my $decoder = "decoder_control.cgi?user=$user&pwd=$pwd";

#  Instead of writing a bunch of individual routines lets make real
#  autoloader,  we'll just look up the requested command in this table 
#  and send the corresponding url string

  my %commands = (
      'Up'           => "$decoder&command=1",
      'Down'         => "$decoder&command=3",
      'Left'         => "$decoder&command=5",
      'Right'        => "$decoder&command=7",
      'moveConUp'    => "$decoder&command=1",
      'moveConDown'  => "$decoder&command=3",
      'moveConLeft'  => "$decoder&command=5",
      'moveConRight' => "$decoder&command=7",
      'moveStop'     => "$decoder&command=2",
      'presetHome'   => "$decoder&command=25",
      'reset'        => "reboot.cgi?user=$user&pwd=$pwd",
      'cameraReset'  => "reboot.cgi?user=$user&pwd=$pwd"
      );

#  If the command exists in the table then we send it's url string

  if (exists($commands{$name})) {
    return($self->sendCmd($commands{$name}));
  }

#  Otherwise we fail

  Fatal( "Can't access $name member of object of class $class" );
}



sub open {
  my $self = shift;

  $self->loadMonitor();
  Debug( "Camera open" );
  use LWP::UserAgent;
  $self->{ua} = LWP::UserAgent->new;
  $self->{ua}->agent( "ZoneMinder Control Agent/".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" );

  my $res = $self->{ua}->request($req);

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

  return( $result );
}



1;
__END__


=head1 NAME

ZoneMinder::Control::HooTooIPCam - Perl extension to zoneminder to implement
the control protocol for the HooToo IP Camera

=head1 SYNOPSIS

use ZoneMinder::Control::HooTooIPCam;

=head1 DESCRIPTION

An implementation of the control protocol for the HooToo IP Camera for 
zoneminder.  

=head1 EXPORT

None by default.



=head1 SEE ALSO

ZoneMinder
ZoneMinder::Control

=head1 AUTHOR

Steven M Campbell

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2010 by Steven M Campbell

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.3 or,
at your option, any later version of Perl 5 you may have available.


=cut
Enjoy and Use the Source!
Rev Eggplant
sraasch
Posts: 3
Joined: Fri Jul 09, 2010 3:35 pm

Newb questions about configuring a HooToo camera

Post by sraasch »

I managed to buy two of these Hootoo cameras myself... I was hoping that someone here could help me get ZM configured to use them.

I've put the module provided above in place, but I can't even get video/images from them, so I'll let the control aspect wait on that.

My monitor settings are:
General
----------
source type: remote
function: monitor
enabled: checked
max fps: 10 or blank (no difference)
alarm max fps: 10 or blank (no difference)
ref image blend: 7

Source
---------
protocol: http
method: simple
host name: 192.168.1.30
host port: 80 (this is correct)
host path: /videostream.cgi (tried this with user/pass also)
host subpath: <blank>
colours: 24 bit
width: 640
height: 480

Everything else left with defaults

I appreciate any help you can give!
eggplant37
Posts: 3
Joined: Tue Jun 15, 2010 12:07 am
Location: Warren, MI

Re: Newb questions about configuring a HooToo camera

Post by eggplant37 »

sraasch wrote:I managed to buy two of these Hootoo cameras myself... I was hoping that someone here could help me get ZM configured to use them.

I've put the module provided above in place, but I can't even get video/images from them, so I'll let the control aspect wait on that.

My monitor settings are:
General
----------
source type: remote
function: monitor
enabled: checked
max fps: 10 or blank (no difference)
alarm max fps: 10 or blank (no difference)
ref image blend: 7

Source
---------
protocol: http
method: simple
host name: 192.168.1.30
host port: 80 (this is correct)
host path: /videostream.cgi (tried this with user/pass also)
host subpath: <blank>
colours: 24 bit
width: 640
height: 480

Everything else left with defaults

I appreciate any help you can give!
Happy to help!

Change your settings to as follows:

host path: /videostream.cgi?user=admin&pwd=&resolution=8

This assumes that your admin username hasn't been changed nor a password added.

Change your width/height to 320/240 (change to resolution=32 for 640 x 480).

Holler with what results you end up with, and then we can tackle controls further.
Rev Eggplant
Post Reply