Setting up motion detection with Foscam FI9900P

Moderator: leecollings

Post Reply
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Setting up motion detection with Foscam FI9900P

Post by marmachine »

Hi all,

I am currently trying to setup motion detection by using my Foscam FI9900P.
So far i have successfully added the cam to Domoticz, i have a (virtual) switch and i understand (tested) how to turn that specific switch on/off.

I have to say, i'm new to Linux, Raspberry Pi and just starting with Domoticz. Being familiar with PHP, i do understand a bit of coding and i already have some LUA scripts running... Linux itself is still a bit of a mystery to me!

I have installed the "motion package" and i think i have got it running pretty much. The hardest part now seems to be the configuring, especially with Foscam since i learned that it doesn't support a raw mjpeg stream. However, the snapshot URL seems to work fine and within Domoticz i am able to open the camera stream. To me it seems that Domoticz also doesn't bother with raw mjpeg, but uses snapshots instead.

Anyway, after some day's i am now about to give up... so maybe someone here to help me out or give some direction. My logfile seems to say there is an issue with rights... but i don't need to save anything, i only want to trigger motion right now. Next step could be to save some pictures and send out an email with those attached.

Here's my logfile:

Code: Select all

Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] motion_startup: Using default log level (NTC) (6)
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] motion_startup: Motion 3.2.12+git20140228 Started
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] motion_startup: Logging to syslog
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] motion_startup: Using default log type (ALL)
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] motion_startup: Using log type (ALL) log level (NTC)
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ENC] ffmpeg_init: ffmpeg LIBAVCODEC_BUILD 3670016 LIBAVFORMAT_BUILD 3670272
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] main: Thread 1 is from /etc/motion/motion.conf
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] main: Thread 1 is device: http://192.168.#.##:##/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=USERNAME&pwd=PASSWORD input -1
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] main: Stream port 0
Mar 27 16:49:24 raspberrypi motion: [0] [NTC] [ALL] main: Waiting for threads to finish, pid: 10701
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [ALL] motion_init: Thread 1 started , motion detection Enabled
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Non-streaming camera (keep-alive not set)
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Content-length present
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Found Conn: close header ('Connection: close')
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_setup_html: connected, going on to read image.
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: disconnecting netcam since keep-alive not set.
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: leaving netcam connected.
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Non-streaming camera (keep-alive not set)
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Content-length present
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Found Conn: close header ('Connection: close')
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: disconnecting netcam since keep-alive not set.
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: leaving netcam connected.
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Non-streaming camera (keep-alive not set)
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Content-length present
Mar 27 16:49:24 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Found Conn: close header ('Connection: close')
...

...
Mar 27 16:49:29 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: disconnecting netcam since keep-alive not set.
Mar 27 16:49:29 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: leaving netcam connected.
Mar 27 16:49:30 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Non-streaming camera (keep-alive not set)
Mar 27 16:49:30 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sun Mar 27 16:51:00 2016 [try http://www.rsyslog.com/e/2007 ]
Mar 27 16:49:30 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Content-length present
Mar 27 16:49:30 raspberrypi motion: [1] [NTC] [NET] netcam_read_first_header: Found Conn: close header ('Connection: close')
Mar 27 16:49:30 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: disconnecting netcam since keep-alive not set.
Mar 27 16:49:30 raspberrypi motion: [1] [NTC] [NET] netcam_read_html_jpeg: leaving netcam connected.
Mar 27 16:49:30 raspberrypi motion: [1] [NTC] [ALL] motion_loop: Thread exiting
Mar 27 16:49:30 raspberrypi motion: [0] [NTC] [ALL] main: Threads finished
Mar 27 16:49:31 raspberrypi motion: [0] [NTC] [ALL] main: Motion terminating
Mar 27 16:51:00 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sun Mar 27 16:52:30 2016 [try http://www.rsyslog.com/e/2007 ]
Mar 27 16:53:00 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sun Mar 27 16:54:30 2016 [try http://www.rsyslog.com/e/2007 ]
Mar 27 16:55:00 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sun Mar 27 16:56:30 2016 [try http://www.rsyslog.com/e/2007 ]
Mar 27 16:57:00 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sun Mar 27 16:58:30 2016 [try http://www.rsyslog.com/e/2007 ]
User avatar
BazsoDombiAndras
Posts: 56
Joined: Thursday 08 January 2015 9:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.10717
Location: Cluj-Napoca, Romania
Contact:

Re: Setting up motion detection with Foscam FI9900P

Post by BazsoDombiAndras »

Can you please specify how you managed to set up the FI9900P with Domoticz? I'm trying to use this image URL, but it does not work:

Code: Select all

/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=#USERNAME&pwd=#PASSWORD
Ittiz
Posts: 48
Joined: Tuesday 03 January 2017 0:37
Target OS: Linux
Domoticz version: 13939
Location: USA
Contact:

Re: Setting up motion detection with Foscam FI9900P

Post by Ittiz »

Maybe you have a new Foscam. I have to make an HTTP polling virtual HW in Domoticz to make mine work, see this doc: http://www.foscam.es/descarga/Foscam-IP ... .11.06.pdf

Also here is some code I made to poll my foscams. It's lua this code also checks the IR light which makes pretty good day/night sensor:

Code: Select all

-- Retrieve the request content
s = request['content'];


-- Update some devices

local motionalert = domoticz_applyXPath(s,'//CGI_Result/motionDetectAlarm/text()')
local soundalert = domoticz_applyXPath(s,'//CGI_Result/soundAlarm/text()')
local IR = domoticz_applyXPath(s,'//CGI_Result/infraLedState/text()')

motionalert = motionalert - 1
soundalert = soundalert - 1

domoticz_updateDevice(26,motionalert,"0")
domoticz_updateDevice(27,soundalert,"0")
domoticz_updateDevice(41,IR,"0")
User avatar
BazsoDombiAndras
Posts: 56
Joined: Thursday 08 January 2015 9:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.10717
Location: Cluj-Napoca, Romania
Contact:

Re: Setting up motion detection with Foscam FI9900P

Post by BazsoDombiAndras »

Thank you for your detailed answer!
Yes, it is a new FOSCAM FI9900P. Does it matter if it's new?
No matter what CGI command I try I get -2 as CGI result, which, according to the document you mentioned, means user/password error. I'm 100% certain I'm giving it the correct user/password combination though...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest