Author Topic: Foscam R2 support?  (Read 5122 times)

Offline jsnsmyth

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: Foscam R2 support?
« Reply #15 on: March 24, 2017, 04:27:24 pm »
Here's my experience using the Foscam R2 camera (firmware 2.71.1.34) with Vera Plus UI7.

Following the instructions given in http://forum.micasaverde.com/index.php/topic,37954.msg289029.html#msg289029, I was able to get the camera installed and working in emulation mode.  From other research on the internet, I've come to the conclusion that the R2 does not support mjpeg streaming (see http://foscam.us/forum/how-to-fetch-snapshots-and-mjpeg-stream-on-hd-cameras-t4328.html).  But the emulation mode updates the image every few seconds, so it not so bad.  I think we have to wait for Vera to support H.264 streaming to get live streaming with this camera.  I do find that sometimes when remotely accessing Vera, it can take up to a few minutes for the attempt to stream video to time out before displaying an image using emulation mode.  But the ImperiHome app always returns a camera image very quickly and the Foscam app gives you live video/audio streaming.

I've decided to use the camera's ability to detect motion and send notices to the Foscam smart phone app and emails with snapshots.  I don't really have much interest in using the camera motion detect to trigger other zwave devices.  The "Motion Detection" and "Human Detection" can be enabled/disabled via the cameras html cgi interface.  I created ArmCamera and DisarmCamera scenes that execute Lua code to do this .....

Code: [Select]
-- Arm Camera  ---set position, arm motion and human detection

-- Move Camera (192) to preset position 5
luup.call_action("urn:micasaverde-com:serviceId:PanTiltZoom1", "GoToPreset", {presetNumber = "5"} , 192);

-- Arm Camera Motion Detect
luup.inet.wget('http://192.168.1.10:88/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig1&isEnable=1&linkage=2&snapInterval=3&triggerInterval=0&isMovAlarmEnable=1&isPirAlarmEnable=0&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&x1=100&y1=625&width1=9714&height1=9375&threshold1=0&sensitivity1=0&valid1=1&usr=xxxx&pwd=xxxx')

-- Arm Camera Human Detect
luup.inet.wget('http://192.168.1.10:88/cgi-bin/CGIProxy.fcgi?cmd=setHumanDetectConfig&isEnable=1&linkage=130&snapInterval=3&sensitivity=50&settingType=1&isHumanCountEnable=1&HumanNumber=0&cameraAngle=1&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&triggerInterval=5&isHumanBoxingEnable=1&usr=xxxx&pwd=xxxx')

Code: [Select]
-- Disarm Camera (192)--- set position, disarm motion and human detection

-- Move Camera to preset position 6
luup.call_action("urn:micasaverde-com:serviceId:PanTiltZoom1", "GoToPreset", {presetNumber = "6"} , 192);

-- Disarm Camera Motion Detect
luup.inet.wget('http://192.168.1.10:88/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig1&isEnable=0&usr=xxxx&pwd=xxxx')

-- Disarm Camera Human Detect
luup.inet.wget('http://192.168.1.10:88/cgi-bin/CGIProxy.fcgi?cmd=setHumanDetectConfig&isEnable=0&usr=xxxx&pwd=xxxx')

In the code above, my camera device number is 192 and the ip address:port is 192.168.1.10:88.  Replace these with the values for your camera.  Also replace "xxxx" with the appropriate userID and password for your camera.

The camera also has a sound detection capability, but I have not been able to find the cgi interface for setting that.  But you could enable/disable this through the smartphone app.

Note that when enabling the motion/human detection, you have to provide all the settings, and not just "isEnable".  If you don't, everything will get set to 0 and motion detection will do nothing.  Entering the following url's in your web browser will return the camera's settings.

192.168.1.10:88/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig1&usr=xxxx&pwd=xxxx'
192.168.1.10:88/cgi-bin/CGIProxy.fcgi?cmd=getHumanDetectConfig&usr=xxxx&pwd=xxxx'

Using this you can set up your camera as you wish through the web page interface, then retrieve all the settings.  Use these retrieved settings to modify the Lua code above.

For setting the camera position, the Vera presets 1 through 4 will activate the camera's preset and unchangeable TopMost, BottomMost, LeftMost and RightMost presets.  You can however define you own presets "4" through "16" using the camera's app or web page interface.  The Vera Camera device will let you select your custom presets "4" through "8".

In my opinion, if Vera would support H.264 streaming and motion detect for this camera, it would be perfect, especially considering the relatively low camera price.


Offline rayjr13

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: Foscam R2 support?
« Reply #16 on: March 25, 2017, 06:23:39 pm »
@Horus  Did anyone get any progress with the PTZ?  I can see the images too.  I struggled for a while until I figured out that my password was >12 chars.  But at least its up.  I also did check out the rtsp link on my android device.

AuthomationHD did also have the identical behavior of Vera 2 UI5.  So that is a plus.  well thatalso means it has no contol functions ptz but still if any resolve then it will translate.

Here's to hoping.  It has been a while but who knows maybe someone will take up the cause.

Offline jv9943

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Foscam R2 support?
« Reply #17 on: July 09, 2017, 04:49:44 pm »
Little tip: don't use ";" in your password. And may be other special characters as well.
When I removed the ";" in my password, the 10 steps that were presented in earlier posts (Spanner and others) worked like a charm. Including PTZ, also available in UI7 scenes: move to preset, zoom in/out. Thanks for the excellent Foscam Plug-in!
Probably the code that's recognizing the password from the URL didn't like this special character, it never came beyond "starting up...".

Offline r-noxious

  • Sr. Newbie
  • *
  • Posts: 41
  • Karma: +4/-42
Re: Foscam R2 support?
« Reply #18 on: July 18, 2017, 04:17:35 pm »
Is anyone having issues with R2 after the update a couple days ago? CAMERA UPDATE not Vera. Mine keeps saying not responding in the dashboard.
« Last Edit: July 18, 2017, 04:19:59 pm by r-noxious »