Please help... Can't control FI9821P V2 Foscam from zoneminder

Forum for questions and support relating to the 1.28.x releases only.
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

I hate to admit this, but I have about 10 hours or more in to trying to figure this out. I've tried and looked at just about every single control script out there and can not get this to work. Everytime I get the following error:

Error check failed: '404 Not Found' for URL 192.168.1.141/decoder_control.cgi?command=4&user=admin&pwd=user=myuser&pwd=mypass

I find it strange that it is pulling a default user and pwd as well a defined one. I think it is pulling the defined one from the source path rtsp setting - regardless, it doesn't even look like it is getting to the point where it would even input a user/pass

I do get video in zoneminder from the camera.

I am on zoneminder 1.28.1.

I have tried just about every combination with every script I have and nothing.

I've done this on scripts after I couldtn't get them to work:

If running version 1.25 or newer, open the file. . file above has this change!!!!!

Code: Select all

 Comment the line "use ZoneMinder::Debug qw(:all);
    Uncomment the line "#use ZoneMinder::Logger qw(:all); 

If running version 1.26.5 or newer, open the file. !!

Code: Select all

Change: "$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );"
    With: $self->{ua}->agent( "ZoneMinder Control Agent/"); 

I called foscam and they confirmed it is a genuine foscam camera.

I have tried with usr=myuser&pwd=mypass and also with user=myuser&pwd=mypass
I have tried without anything in these fields
I have tried with the port on the end of the ip. 192.168.1.141:80
I have tried without the port on the end. 192.168.1.141

Yes, the camera is setup to use port 80 right now. I have also tried at the default 88 as well and all combination mentioned above.


Can someone please tell me what I'm missing or if you have a hidden script somewhere that works with this version of zoneminder and my camera (FI9821P V2).

In the camera Device Information it states the following:
System Firmware Version 1.5.2.11
Application Firmaware Version 2.21.1.143

any input at all will be very useful. I'm at the point where I may have to pull the plug on zoneminder as this is the first time I've used it and it isn't going so well.

I do have controllable PZT checked in the options and that option checked under control as well.


If there is more information that I can provide, please let me know and I will be more than happy to immediately provide it.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by knight-of-ni »

404 Not Found' for URL 192.168.1.141/decoder_control.cgi?command=4&user=admin&pwd=user=myuser&pwd=mypass
Error 404, URL not found. The control url being sent to the camera is not correct. This is not any different to the case where you misspell a url in your web browser, and get a 404 response because the web page does not exist.

If you have not typed "decoder_control.cgi" into any of the monitor fields, then you've likely chosen the wrong control type.

To see where the problem lies, we need to see:
- A screenshot of your Source tab
- A screenshot of your Control tab
- If you are using a custom control script, or have modified an existing script in any way, then we need to see the entire contents of the script.
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/
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

Thanks, yes it definitely seems that way.

I'm convinced that non of the built in control scripts work with this camera. Do you know if any of them do, specifically? If not, do you know of a custom script that does?

Camera: FI9821P V2

I have edited the user name and admin so they weren't divulged here, but that should be a moot point when looking at the settings. The control script/protocol you see is simply one I found on Youtube. I have tried the one from the wiki, another from github, and a couple other places, hoping the protocol would match that of the camera I have. Yes, I have tried all the built in ones as well.
Attachments
Screen Shot 2016-01-08 at 8.36.19 AM.png
Screen Shot 2016-01-08 at 8.36.19 AM.png (203.46 KiB) Viewed 11199 times
Screen Shot 2016-01-08 at 8.36.05 AM.png
Screen Shot 2016-01-08 at 8.36.05 AM.png (212.48 KiB) Viewed 11199 times
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by knight-of-ni »

Well, my FI9821W V2 works fine with the stock control scripts. I've never had any kind of problem with this camera using ZoneMinder.
The "P" model physically looks identical to the "W" and appears to have the same web portal. The PTZ commands are almost certainly the same.

Rather than sit around and speculate on what the problem may be, please present the requested information so we can get to fixing it.

UPDATE: I see you updated your post with screenshots
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/
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by knight-of-ni »

Control type of youtube??? Um no. No idea where that came from.

Change the script to Foscam FI9821W <- This assumes you have not modified this script in any way.

Change the Control Device field to the password only.
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/
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by knight-of-ni »

Return Delay field should be empty.

Make sure the resolution you entered into zoneminder matches, exactly, what you've set in the camera.

General instructions are here:
https://wiki.zoneminder.com/Foscam_FI9821W_V2
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/
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

It was just a custom script I had found out there that I wanted to try and just happened to be the last one I had used before calling it a night last night.

I have made the adjustments suggested. Just the password in control field, return delay to 0 and FI9821W script. I get the following when I first opened the camera and went to control:

2016-01-08 11:16:23.300560 zmcontrol 842 INF Control server 1/FI9821W_Y2k starting at 16/01/08 11:16:23 zmcontrol.pl
2016-01-08 11:16:23.282590 zmcontrol 837 INF Starting control server 1/FI9821W_Y2k zmcontrol.pl

I do not receive this after that first time I tried to control it. There are not additional errors, but the control does not work. I am in firefox when trying this, does it matter what browser I'm in?

Update: I tried in safari as well, no response and no additional errors in the log.
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

I have updated FI9821W_Y2k.pm to the github version in case I edited it.

https://github.com/ZoneMinder/ZoneMinde ... 21W_Y2k.pm

Still the same results. I also changed over to port 88 in the event that something was looking at that port by defaul and nothing on the movement side of things. The image/video displays just fine. What settings do I need in move/pan/tilt?

In move I have:
Can move: yes
Diagonally: yes
Continuous: Yes
other options are set to no

Pan:
Can Pan: Yes.
Everything else is no or 0
Update: Tried setting has pan speed to yes with min speed: 1 max speed: 50, still not reactive

Titlt:
Can tilt: Yes
Everything else is no or 0
Update: Tried setting has tilt speed to yes with min speed: 1 max speed: 50, still not reactive

Zoom, Focus, White, Iris are all no/unchecked and 0

Presets:
All checked and set to 8
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

This is about the only error I can get out of it when in control now, but still no movement:

2016-01-08 12:13:08.542880 zmcontrol 753 FAT Can't access presetHome member of object of class ZoneMinder::Control::FI9821W_Y2k zmcontrol.pl
2016-01-08 12:13:05.729958 web_js 527 ERR TypeError: $(...).preset.getValue is not a function http: //192.168.1.150:8585/zm/skins/flat/views/js/controlpreset.js
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by knight-of-ni »

The only thing you need to do to enable ptz control with that camera is:
- Check the controllable checkbox
- Select Foscam 9821 from the drop down
- Put your admin password into the Control Device Field
- Put your IP Address and the port number into the Control Address field. The port number is the same number you used in the Source tab.
- Set the Auto Stop Timeout. 1 works, but a smaller value is often more precise

This is right out the instructions in the wiki. That's all you have to do.
You will likely get yourself into trouble if you change anything else, including the control scripts.
If you've got time, I recommend a reinstall to put everything back to the original state. Start over with a new database.

Something else to try is an experiment to verify the right codes are being sent out.
Install and run wireshark on the zoneminder server.
From the camera's web portal, push one and only one ptz command button. It does not matter what it is.
Stop wireshark, and find the entry. You should be able to see the entire url sent to the camera.

Now repeat this process, but press the same ptz command button in zoneminder.
Find the url in wireshark and compare it to the first.
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/
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

I am able to install it on the client that I am working from, but not on the server itself as zoneminder is running as a docker package.
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

Fresh install and left everything as is except what was mentioned to change. Still nothing. I'm probably going to give this a go for another day or two and then can the program if I can't get this to work. I've spent too much time already to simply get movement in the camera. I had such high hopes :(

I do get these errors on startup for a while and then they seem to go away.


2016-01-08 15:32:56.017079 web_js 983 ERR getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-434339s.sock ) failed: No such file or directory - checkStreamForErrors() ?view=watch
2016-01-08 15:32:55.958283 web_php 983 ERR socket_sendto( /var/run/zm/zms-434339s.sock ) failed: No such file or directory /config/data/zoneminder/includes/functions.php 2330
live4soccer7
Posts: 9
Joined: Fri Jan 08, 2016 5:53 am

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by live4soccer7 »

Thanks for all the help. I've decided to with blue iris for now. I was up and running in 10 minutes with pzt and all. I'd definitely be interested in a resolution to this, if anyone has it. I'd still like to use zoneminder if I could get it to work.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by asker »

I wonder if you are using a new version of the camera which is compliant to the HD CGI manual of Foscam?

Would you like to give the 9831W control script a try? I am on travel right now and won't be able to dive into the 9821 script for a week , but am familiar with the 9831W script

If you are willing:

a) Switch to the 9831W script. If its not part of 1.28, get it from https://raw.githubusercontent.com/ZoneM ... FI9831W.pm

b) If you need help in adding a new control protocol after downloading it https://wiki.zoneminder.com/How_to_cont ... proper_way

c) Set up your control like this:
Image

d) Let me know what you see in logs when you try a pan
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Please help... Can't control FI9821P V2 Foscam from zoneminder

Post by knight-of-ni »

What follows is the url format for the ptz commands for the 9821W.
You can easily test these by placing them into your browser.
Naturally, replace the ip, port, username, and password with the values you have set in your camera.

You should also test these command directly on the zoneminder server. If you don't have a gui, then do it from the command line using wget. e.g.

Code: Select all

wget http://ip:port/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveLeft&usr=xxx&pwd=xxx

MoveLeft:

Code: Select all

http://ip:port/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveLeft&usr=xxx&pwd=xxx
MoveRight:

Code: Select all

http://ip:port/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveRight&usr=xxx&pwd=xxx
MoveUp:

Code: Select all

http://ip:port/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveUp&usr=xxx&pwd=xxx
MoveDown:

Code: Select all

http://ip:port/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveDown&usr=xxx&pwd=xxx
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/
Locked