Foscam FI8910w

Forum for questions and support relating to the 1.25.x releases only.
benb
Posts: 7
Joined: Sun Mar 18, 2012 6:05 pm

Foscam FI8910w

Postby benb » Sun Mar 18, 2012 6:30 pm

Hi I am using ubuntu 12.04 with a Foscam FI8910W
I am able to get a video stream working however I cannot get the pan and tilt working at all.
using firefox i'm able to get the camera to move and I wrote a very simple perl script that I can control this camera with. However when I try to use 'zmcontrol.pl --id 1 --command=moveConLeft' at a command line, I recieve this error '2012-03-18 12:20:18.960420 zmcontrol 6199 FAT Can't connect: Permission denied zmcontrol.pl'.
Also when I tring using the actual controls i get this error 'Control response was status = undefined
message = /usr/bin/zmcontrol.pl --autostop --command=moveConUp --id=1=>' and from the logs '2012-03-18 12:23:13.951470 zmcontrol 6217 FAT Can't connect: No such file or directory zmcontrol.pl'

I have been searching for more information on the use of the zmcontrol.pl and how it works (including parmeters and resulting error messages. I also have installed wireshark to look at the packet being sent to the camera. However no packet with the expected control strings are being sent. I have started wondering if this may be a permission or a path issue. Any ideas would be appreciated, thanks

looking in the forums and searching the internet I have not been able to solve this problem. While I dont know very much about perl, I have used php and some other programming languages.

User avatar
knnniggett
Posts: 1492
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Foscam FI8910w

Postby knnniggett » Tue Mar 20, 2012 6:14 pm

It could be a number of things, but first check the following line of code in your PTZ control script.
If it says this:

Code: Select all

use ZoneMinder::Debug qw(:all);

then change it to this:

Code: Select all

use ZoneMinder::Logger qw(:all);

The latest version of Zoneminder requires this change to be made for all PTZ control scripts.

Once the change is made, enter this from a command prompt as root to reset the control function:

Code: Select all

killall -9 zmcontrol.pl
I only respond to technical support requests through forum topics. Please do not pm support requests to me.

Using the ESP8266 WiFi chip as an external trigger source.
http://zmtrigger.blogspot.com/

benb
Posts: 7
Joined: Sun Mar 18, 2012 6:05 pm

Re: Foscam FI8910w

Postby benb » Thu Mar 22, 2012 5:53 pm

thankyou for your reply I have made the change suggested.



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



then change it to this:


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



I then enter this into terminal

Code: Select all

killall -9 zmcontrol.pl
zmcontrol.pl: no process found


the result was just the same as before
Control response was status = undefined
message = /usr/bin/zmcontrol.pl --autostop --command=moveConUp --id=1=>


please let me know if you have any other suggestions. In the mean time I will work on this issue some more.


after a restart the message changeged to this:
Control response was status = undefined
message = /usr/bin/zmcontrol.pl --panspeed= --tiltspeed= --autostop --command=moveConUpRight --id=1=> // Usage: zmcontrol.pl --id <monitor_id> --command=<command> <various options>

ianos
Posts: 1
Joined: Tue Mar 20, 2012 9:02 pm

Re: Foscam FI8910w

Postby ianos » Thu Mar 22, 2012 8:08 pm

Hi,

I had a similar problem with some FI8918W and i managed to solve it by doing the following in zoneminder 1.25.0

1. in the control script change the line

Code: Select all

 use ZoneMinder::Debug qw(:all);

to

Code: Select all

use ZoneMinder::Logger qw(:all);


2. create a user in the cam with operator privilegges in your camera. In zoneminder at the control tab leave the control device empty and modify the control address to include the username and the pass of the user you created in the form username:password@camera_ip_address

Hope this helps,

Ianos

User avatar
knnniggett
Posts: 1492
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Foscam FI8910w

Postby knnniggett » Fri Mar 23, 2012 8:04 pm

benb,
Since you've already made the appropriate changes to your PTZ control file for zoneminder 1.25 and that didn't solve the problem, please post the following information:
  • Linux Distro
  • path to your PTZ control file
  • As lanos mentions, are you sending the right user credentials to the camera?
  • Exact steps you took to add & then program the PTZ control into zoneminder. Screenshots of your zoneminder config would be helpful here. Where you following a guide? if so, which one?
  • post the output of the following:

    Code: Select all

    perl {your_ptz_control_file.pm}

They are a lot of steps that must be done correctly to get your PTZ control file working. It simply won't work if even one step is missed.
I only respond to technical support requests through forum topics. Please do not pm support requests to me.

Using the ESP8266 WiFi chip as an external trigger source.
http://zmtrigger.blogspot.com/

TylerSchwend
Posts: 20
Joined: Sat Nov 05, 2011 11:03 pm

Re: Foscam FI8910w

Postby TylerSchwend » Sat Mar 24, 2012 6:37 pm

Since 1.25 is now more common, I updated the FI8915W wiki to include this modification to the control script. Thanks!

benb
Posts: 7
Joined: Sun Mar 18, 2012 6:05 pm

Re: Foscam FI8910w

Postby benb » Mon Apr 02, 2012 2:55 am

thanks for all the help and information. I really appreciate the help I have recieved. After reading the latest replys I ran the following command:

Code: Select all

perl {your_ptz_control_file.pm}
and realized the changes I had made where to the wrong file. After making these changes, I reran the command and only got a warning. I then went ahead and tried out the control section of the camera again. The button still did not seem to work, however I ran a packet capure with wireshark and found that the correct command was actually being sent. Digging into it a little more I found that a stop command was also being sent fairly quickly afterwards so the camera never moved. I then modified the file to not send the stop command and it worked!!! here is the code changes I made. from this

Code: Select all

my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


to

Code: Select all

my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


by adding the sleep command I was able to get this to function.

benb
Posts: 7
Joined: Sun Mar 18, 2012 6:05 pm

Re: Foscam FI8910w

Postby benb » Mon Apr 02, 2012 2:59 am

the key for me to get this to work was definitely Knnniggett post on the changes from

Code: Select all

use ZoneMinder::Debug qw(:all);

to

Code: Select all

use ZoneMinder::Logger qw(:all);

User avatar
knnniggett
Posts: 1492
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Foscam FI8910w

Postby knnniggett » Mon Apr 02, 2012 11:55 am

Glad you got it working.

I don't use the Foscam script myself, but I've noticed that most of the control scripts make use of the "Auto Stop Timeout" field shown under the Control tab of your camera.

This allows you to tweak the delay time straight from your web browser. Of course, the sleep command inserted straight into the perl script will work too.

benb wrote:thanks for all the help and information. I really appreciate the help I have recieved. After reading the latest replys I ran the following command:

Code: Select all

perl {your_ptz_control_file.pm}
and realized the changes I had made where to the wrong file. After making these changes, I reran the command and only got a warning. I then went ahead and tried out the control section of the camera again. The button still did not seem to work, however I ran a packet capure with wireshark and found that the correct command was actually being sent. Digging into it a little more I found that a stop command was also being sent fairly quickly afterwards so the camera never moved. I then modified the file to not send the stop command and it worked!!! here is the code changes I made. from this

Code: Select all

my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


to

Code: Select all

my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


by adding the sleep command I was able to get this to function.
I only respond to technical support requests through forum topics. Please do not pm support requests to me.

Using the ESP8266 WiFi chip as an external trigger source.
http://zmtrigger.blogspot.com/

benb
Posts: 7
Joined: Sun Mar 18, 2012 6:05 pm

Re: Foscam FI8910w

Postby benb » Mon Apr 16, 2012 9:21 pm

I will have to look into the "Auto Stop Timeout" field and see if I can get that to work
I really do appreciate the help :lol:

eren
Posts: 3
Joined: Mon Apr 09, 2012 5:02 am

Re: Foscam FI8910w

Postby eren » Tue Apr 17, 2012 12:18 am

Do you mind sharing your script? I used the F8918W script but I can't get it to work. I can run the commands manually and they work fine, but nothing works using Zoneminder. The control log also shows no errors.

I also realized that I get no messages when I try the "perl controlfile.pm" command suggested in this thread. Am I supposed to run it in the perl shell?

Thanks

jbaiao
Posts: 2
Joined: Wed Apr 25, 2012 10:25 pm

Re: Foscam FI8910w

Postby jbaiao » Wed Apr 25, 2012 10:29 pm

Hi there.
I've been having the same problem.
I changed the script as indicated in the wiki and nothing!
Until I remembered that I use the port 8090, changed to 80 and it worked immediately!
I think the port to control only works in 80.

benb
Posts: 7
Joined: Sun Mar 18, 2012 6:05 pm

Re: Foscam FI8910w

Postby benb » Mon Jun 11, 2012 2:07 am

I also realized that I get no messages when I try the "perl controlfile.pm" command suggested in this thread. Am I supposed to run it in the perl shell?

yes, run something like this to test your control script

Code: Select all

zmcontrol.pl --id 1 --command=moveConLeft

Code: Select all

# ==========================================================================
#
# 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 for use with Foscam FI8910W IP 01102011 by Ben Boone
# 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::FoscamFI8910W;

use 5.006;
use strict;
use warnings;

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

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

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

# ==========================================================================
#
# Foscam FI8910w IP Control Protocol
#
# ==========================================================================

#use ZoneMinder::Debug qw(:all);
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" );
}
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=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$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=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Stop
sub moveStop
{
my $self = shift;
Debug( "Move Stop" );
my $cmd = "decoder_control.cgi?user=admin&pwd=&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=";
$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=";
$self->sendCmd( $cmd );
}

1;

User avatar
knnniggett
Posts: 1492
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Foscam FI8910w

Postby knnniggett » Mon Jun 11, 2012 12:24 pm

eren wrote:I also realized that I get no messages when I try the "perl controlfile.pm" command suggested in this thread. Am I supposed to run it in the perl shell?


The example you are quoting "perl controlfile.pm" is only used to check for syntax errors in your perl script. If the script returns nothing, then you know there are no errors of that kind. Executing the script this way won't control the camera in anyway.

Another user has already posted the solution for testing zoneminder camera control via the command line.
I only respond to technical support requests through forum topics. Please do not pm support requests to me.

Using the ESP8266 WiFi chip as an external trigger source.
http://zmtrigger.blogspot.com/


Return to “ZoneMinder 1.25.x”

Who is online

Users browsing this forum: No registered users and 4 guests