Foscam FI8910w
Foscam FI8910w
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.
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.
- knight-of-ni
- Posts: 2406
- Joined: Thu Oct 18, 2007 1:55 pm
- Location: Shiloh, IL
Re: Foscam FI8910w
It could be a number of things, but first check the following line of code in your PTZ control script.
If it says this:
then change it to this:
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:
If it says this:
Code: Select all
use ZoneMinder::Debug qw(:all);
Code: Select all
use ZoneMinder::Logger qw(:all);
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
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
All of these can be found at https://zoneminder.blogspot.com/
Re: Foscam FI8910w
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
the result was just the same as before
after a restart the message changeged to this:
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
please let me know if you have any other suggestions. In the mean time I will work on this issue some more.Control response was status = undefined
message = /usr/bin/zmcontrol.pl --autostop --command=moveConUp --id=1=>
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>
Re: Foscam FI8910w
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
to
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
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);
Code: Select all
use ZoneMinder::Logger qw(:all);
Hope this helps,
Ianos
- knight-of-ni
- Posts: 2406
- Joined: Thu Oct 18, 2007 1:55 pm
- Location: Shiloh, IL
Re: Foscam FI8910w
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:
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}
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
All of these can be found at https://zoneminder.blogspot.com/
-
- Posts: 22
- Joined: Sat Nov 05, 2011 11:03 pm
Re: Foscam FI8910w
Since 1.25 is now more common, I updated the FI8915W wiki to include this modification to the control script. Thanks!
Re: Foscam FI8910w
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: 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
to
by adding the sleep command I was able to get this to function.
Code: Select all
perl {your_ptz_control_file.pm}
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 );
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 );
Re: Foscam FI8910w
the key for me to get this to work was definitely Knnniggett post on the changes from
to
Code: Select all
use ZoneMinder::Debug qw(:all);
Code: Select all
use ZoneMinder::Logger qw(:all);
- knight-of-ni
- Posts: 2406
- Joined: Thu Oct 18, 2007 1:55 pm
- Location: Shiloh, IL
Re: Foscam FI8910w
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.
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: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 thisCode: Select all
perl {your_ptz_control_file.pm}
toCode: 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 );
by adding the sleep command I was able to get this to function.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 );
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
All of these can be found at https://zoneminder.blogspot.com/
Re: Foscam FI8910w
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
I really do appreciate the help
Re: Foscam FI8910w
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
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
Re: Foscam FI8910w
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.
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.
Re: Foscam FI8910w
yes, run something like this to test your control scriptI 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?
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;
- knight-of-ni
- Posts: 2406
- Joined: Thu Oct 18, 2007 1:55 pm
- Location: Shiloh, IL
Re: Foscam FI8910w
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.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?
Another user has already posted the solution for testing zoneminder camera control via the command line.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
All of these can be found at https://zoneminder.blogspot.com/