ZoneMinder 1.25.0 with Foscam FI8920W Control problem
Posted: Fri Jan 04, 2013 10:22 am
I'm having problem with the control of my Foscam FI8910W IP based cameras!
The recipe on the wikis.zoneminder.com has been use to set it up (http://www.zoneminder.com/wiki/index.php/Foscam_FI8918W) There is the info that model FI8910W uses the same command as the FI8918W model.
I'm 110% sure that the came operates correctly, as I'm able to send the command via a browser to the camera, that works as expected!
The error that I'm getting is a popup Window. Attached (Ignore the fact the it shows http://localhost:8090 as I'm connecting via a SSH connection)
And I'm getting this in the log file:
Jan 4 10:42:14 Samba64 zmcontrol[21512]: INF [Starting control server 3/Foscam]
Jan 4 10:42:14 Samba64 zmcontrol[21524]: INF [Control server 3/Foscam starting at 13/01/04 10:42:14]
Jan 4 10:42:24 Samba64 zmcontrol[21512]: FAT [Can't connect: No such file or directory]
Jan 4 10:42:24 Samba64 web_php[2125]: ERR [/usr/local/bin/zmcontrol.pl --autostop --command=moveConDown --id=3=>]
Note the "[Can't connect: No such file or directory]" I think this might be the problem!
The file is in:
-r--r--r-- 1 root root 10990 maj 1 2012 AxisV2.pm
-r-xr-xr-x 1 root root 11605 jan 2 09:33 FoscamFI8908W-2.pm
-r-xr-xr-x 1 root root 5202 jan 2 09:18 FoscamFI8908W.pm
-rw-r--r-- 1 root root 6483 jan 3 13:26 FoscamFI8910W-10.pm
-rw-r--r-- 1 root root 6483 jan 3 13:15 FoscamFI8918W-10.pm
-rwxr-xr-x 1 root root 6019 dec 25 14:52 FoscamFI8918W.pm
-rw-r--r-- 1 root root 6473 jan 3 13:36 Foscam.pm
-r--r--r-- 1 root root 5261 maj 1 2012 mjpgStreamer.pm
-r--r--r-- 1 root root 5274 maj 1 2012 Ncs370.pm
-r--r--r-- 1 root root 7382 maj 1 2012 PanasonicIP.pm
-r--r--r-- 1 root root 18941 maj 1 2012 PelcoD.pm
-r--r--r-- 1 root root 20103 maj 1 2012 Visca.pm
-rw-r--r-- 1 root root 6018 dec 20 21:58 xxxxFoscamFI8918W.pm
lars@Samba64:/usr/local/share/perl/5.14.2/ZoneMinder/Control$
Right now I'm trying to use the Foscam.pm
I have been allover the web to search for a solution, and I am able to find people who has the same error, but no solution to the problem!
I'm using Ubuntu 12.04 LTS as the server, running in 64 bit on a Intel(R) Atom(TM) CPU D2700 @ 2.13GHz with 4 GB of memory
Any help is appreciated!
Thanx in advance
Lars
Here is the Foscam.pm file:
___START____
# ==========================================================================
#
# ZoneMinder Foscam FI8918W IP Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0003 $
# Copyright (C) 2001-2008 Philip Coombes
# Modified for use with Foscam FI8908W IP Camera by Dave Harris
# Modified for use with Foscam FI8918W IP 01102011
# Modified and added MOVE-STOP - To use reset PTZ Settings to default (0) 01112011
# Modified and added Video Presets (PacoLM) - To use edit control-presets-add num presets to 3 - 01112011
# 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 Foscam FI8918W IP camera control
# protocol
#
package ZoneMinder::Control::Foscam;
use 5.006;
use strict;
use warnings;
require ZoneMinder::Base;
require ZoneMinder::Control;
our @ISA = qw(ZoneMinder::Control);
our $VERSION = $ZoneMinder::Base::VERSION;
# ==========================================================================
#
# Foscam FI8918W IP Control Protocol
#
# ==========================================================================
use ZoneMinder::Debug 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" );
}
our $stop_command;
sub open
{
my $self = shift;
$self->loadMonitor();
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 );
}
sub reset
{
my $self = shift;
Debug( "Camera Reset" );
my $cmd = "reboot.cgi?user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Up Arrow
sub moveConUp
{
my $self = shift;
$stop_command = "1";
Debug( "Move Up" );
my $cmd = "decoder_control.cgi?command=0&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Down Arrow
sub moveConDown
{
my $self = shift;
$stop_command = "1";
Debug( "Move Down" );
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Left Arrow
sub moveConLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Left" );
my $cmd = "decoder_control.cgi?command=4&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Right Arrow
sub moveConRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Right" );
my $cmd = "decoder_control.cgi?command=6&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Diagonally Up Right Arrow
sub moveConUpRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Up Right" );
my $cmd = "decoder_control.cgi?command=91&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Diagonally Down Right Arrow
sub moveConDownRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Down Right" );
my $cmd = "decoder_control.cgi?command=93&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Diagonally Up Left Arrow
sub moveConUpLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Up Left" );
my $cmd = "decoder_control.cgi?command=90&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Diagonally Down Left Arrow
sub moveConDownLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Down Left" );
my $cmd = "decoder_control.cgi?command=92&user=admin&pwd=admin";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
#Stop
sub moveStop
{
my $self = shift;
Debug( "Move Stop" );
my $cmd = "decoder_control.cgi?user=admin&pwd=admin&command=1";
$self->sendCmd( $cmd );
}
#Move Camera to Home Position
sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "decoder_control.cgi?command=25&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
# Choose video preset
# preset 1 -> 50 Hz mode (0)
# preset 2 -> 60 Hz mode (1)
# preset 3 -> outdoors mode (2)
sub presetGoto
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
my $preset = ( $preset - 1 );
Debug( "Goto Preset $preset" );
my $cmd = "camera_control.cgi?param=3&value=$preset&user=admin&pwd=admin";
$self->sendCmd( $cmd );
}
1;
__END_____