[OBSOLETE] Foscam Camera Device Handler Universal DTH with Motion Detection - SD (FI89xx), HD Ambarella FI98xx, FI99xx, Cx, Gx, Rx, Ex, Zx, Fosbaby

This is an Integration for Foscam Cameras with SmartThings and works with all Foscam cameras (Standard Definition, High Definition, Ambarella, etc)



Classic App

We’ve created a customized version for the Foscam Device Type which allows for integration of the IP Camera’s into SmartThings. We’ve also been touch with Foscam to add new features to their upcoming lineup for cameras.

Installation instructions and troubleshooting tips can be found here

Feature Summary (varies by model)

  • Turn on/off motion detection
  • Turn on/off sound detection
  • Get notified on motion/sound alarms
  • Detect flip/mirror settings configured through Foscam app/camera web console
  • Detect motion detection areas/sensitivity configured through Foscam app/camera web console
  • Detect custom Preset names/settings (first 6)
  • 4 fixed preset locations (top, bottom, left, right)
  • Horizontal/Vertical/Stop cruise
  • Night vision/LED control (Auto, On, Off)
  • Remote reboots
  • Define actions (cruise, snapshots, switches, etc) when motion alarms are detected
  • (Classic app) 9 way pan/tilt control
  • (Classic app) Live video view
  • (Classic app) Snapshots
  • Configurable options
    • Motion sensitivity
    • Sound sensitivity
    • Enable MJPEG mode for ActionTiles/Web streaming
    • Separate URL for video streaming and local controls
    • Support for LAN IP, DNS names and public IP (see FAQ)
    • Motion sensitivity
    • Sound sensitivity
    • Human/PIR motion detection
    • Intruder detected options (configure smtp/recording location through Foscam app/web console)
      • Send eMails
      • Camera audio alerts
      • Take snapshots
      • Record videos
    • People counting/bounding boxes/PIR sensitivity
    • Upload to cloud
    • Push notification to foscam app
  • Send motion detected notifications via SmartThings
    • Push
    • SMS multiple numbers
    • Speak announcements (Sonos/Alexa)
  • Tested with the following Foscam models
    • SD (FI89xx)
    • HD (FI98xx)
    • Ambarella (FI99xx)
    • Bxx (B1)
    • Cxx (C1, C1Lite, C2, C2E)
    • Exx (E1)
    • Gxx (G2, G2EP, G4, G4EP)
    • Rxx (R2, R2C, R2E, R4, R4S)
    • Zxx (Z2)
    • Fosbaby

Check out these other SmartApps

Custom DTH command to use with CoRE/WebCoRE

  • Control LED’s - ledOn, ledOff, ledAuto
  • Activate/stop cruise - horizontalCruise, verticalCruise, stopCruise
  • Activate presets - presetA, presetB, presetC, presetD, presetE, presetF, presetTop, presetBottom, presetLeft, presetRight
  • Turn on/off Motion Detection - alarmOn, alarmOff

The DTH can differentiate between 3 different types of events (if supported and reported by the camera)

  • Motion
  • Sound
  • Human detection (PIR) (e.g. R2 foscams)

Using an app like CoRE or WebCoRE, you can create a rule to inspect the descriptionText field of the reported motion event and if it contains:

  • detected motion , it’s a regular motion detection
  • detected human motion then it’s a PIR motion detection
  • sound motion then it’s a sound detection

MOTION DETECTION AND RECORDING: Motion detection can be configured to take pictures, eMail, video, local alarm etc and also use the motion alarm notifications to set off actions in SmartThings (can used as a motion sensor). Motion detection eMail feature requires the camera to be initially configured through the camera’s web interface as the motion detection eMail will be sent by the camera and not the SmartApp. Similarly the duration of the video etc need to be initially configured through the camera web interface, the video capture is done by the camera on detection motion and cannot be triggered by the SmartApp.

LIVE STREAMING CONFIGURATION: The new SmartThings app does not support live streaming. For the Classic app only, see FAQ

SD camera (640x480 or less resolution) : use this URL http://IPADDRESS:PORT/videostream.cgi?user=USERNAME&pwd=PASSWORD.

HD Camera (720p or high resolution) AND your camera supports MJPEG (check the specs): Enable the MJPEG mode in the Device Preference page (gear icon in Classic ST app) from your ST mobile App and then use this URL http://IPADDRESS:PORT/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=USERNAME&pwd=PASSWORD

HD Camera Stop Motion Video Stream : You can also use JPEG snapshot if you camera doesn’t support MJPEG mode, use this URL http://IPADDRESS:PORT/cgi-bin/CGIStream.cgi?cmd=snapPicture2&usr=USERNAME&pwd=PASSWORD

If you have any suggestions please feel free to let us know.

This device handler is available on the RBoy Apps Server

Refer to our facebook page http://www.facebook.com/RBoySTApps to get the latest news and updates.

The latest version are available on the RBoy Apps server

(C) RBoy Apps


Your site is asking for a username and password to log in.


@RBoy Do you have a screen shot of what the updated device type looks like so I can decide whether it is worth putting 10 bucks into?

1 Like

His Facebook site explains you pay to play…so the site won’t let you in without that $10.

1 Like

I figured that out from other posts. I guess it should be explained better in the OP.


I paid up and got access…I actually like someone is creating a place to get some purpose built apps…there some good surprises in there. My Foscam comes tomorrow so will try this app out then.


do post your experience. I for one would find it useful. thanks.

1 Like

So far The FOSCAM camera stuff doesn’t work. Trying to make the device type in the IDE, and it times out every time. No idea if its the IDE or the code. Pretty sure its the IDE being its wonderful self.

After a half hour of putzing, I have an device type in there and its in my Things…but doesn’t seem to do much. I see no video, clicking on “take” just changes the icon color and nothing happens. Things like what “on and off” do have no context…I expect a video stream in the big gray area at top and nothing. Tried to move the camera via controls and presets and nothing.

Alternately, I put my Foscam info in the Action Dashboard, and boom, its there.

No idea if we even get support from these guys as they provide no info on it.

Trying his locks stuff next. Have a Kwikset that I can already change codes with via a different app using custom device type from the community. Some info on this thing but not enough to answer my basic questions either. I think maybe you need his device type, but it doesn’t really say.

1 Like

You will not see a video steam in this or any other device type. At least in the ST mobile app. The platform does not currently support streaming video. This is something that should be addressed when hub V2 is released.

1 Like

thanks for that reminder. None of the other functions work either for the camera, and neither do the locks. Regardless, while he may believe he has enough info published, I am approaching like a normal user and hit roadblocks.

I have other comments I will drive into the other thread after I get to Napa tomorrow.

True, these found familiar perhaps I’ll put a note with the limitations and sample use cases.

ST platform doesn’t support support video streaming (as @jodyalbritton said it’s something in the pipeline). Right now it’s just control and static stuff (like images). If I understand the Action dashboard, that’s actually a browser service, so you’re not using the ST app rather a browser capabilities which allows you to use the stream function of the webcam.

The way this code was designed was to allow “control” and “event” integration with SmartThings, so for e.g. when you “arm” your security (enable motion sensors), the motion tracking feature - which looks for motion and sets of events (emails, sound, video recording, pictures etc) when there is motion detected.
Couple of things to note, the initial configuration (eMail server, FTP storage/SD storage) is done via the Foscam web page.
SmartThings device code can be used to control the enabling/disabling of the various events, the sensitivity. So here’s an example.
When mode is set to night, turn on the Foscam device (i.e. monitoring is enabled, now it looks for motions). In the device preferences you can set the options, sensitivity of motion (high, low etc), whether it should send an eMail, sound a local alarm, take pictures, record video etc when the motion is detected.
Similarly another use case, you can configure this as an alarm. e.g. when motion is detected, turn on the Foscam Alarm - this will enable the motion sensor and if strobe is selected it’ll also take a picture. This picture BTW will show up on your ST app device.
The Take picture button takes a picture and then it shows up on your ST app. If you aren’t seeing the picture than likely ST isn’t able to connect to the camera. The picture is more for reviewing the events of an alarm motion event.
The pan controls, while present I didn’t find particularly useful since there’s no streaming video, however the reboot button and cruise button are helpful. The Cruise can be enabled via a smart app, so when the alarm is set off using a custom app you can enable the cruise which in then while the camera is recording it’ll take a sweeping video of the room while cruising.

Once ST supports video streaming will see how to integrate the camera streaming services into the app as well.

Hope that helps.

1 Like

If no functions are working then it’s not configured properly, check your preferences. Are you using an internal ip address or external ip address (if external, have you configured port forwarding). Similarly have you configured the correct ports, username and password?

I’ve setup it up with an external IP address, port forwarding and it’s working beautifully even from the internet, check your settings (preferences) once more. If it’s an private IP address you can only access it from your LAN and if it’s an external make sure you have loopback disabled on your router or it won’t work.

While I appreciate your response, I will highlight that I mentioned I used the same credentials in the Action Dashboard without incident, and will now mention I used the same via the official Foscam app. All function and all use an external ip with proper port forwarding.

As has been contended elsewhere that the fee includes support, but you don’t publish any vehicle to provide as far as I can find, I have to resort to public feedback. I would prefer to use a proper support vehicle. Despite my skepticism I gave this a shot mostly out of curiosity to how you planned to make a go of this.

If you want to blaze the trail of paid apps before the ST store exists you have to uphold a higher standard of support than the open source contributors here do.

Just a thought from a far too gray CTO from the battles of being a software cloud provider before there was that term.


Thanks. Where does it show up in my app device, these pictures?

The pictures show up on the First tile in the app. One thing I’ve noticed if the pictures aren’t showing up and other buttons are working fine then there’s a “timing” issue, the foscam firmware may be running slow. I hit the Reboot button on the app and try again after a minute and that usually works for me.

If I have my Foscams connected to POE and then plugged into my router, will Smart things be able to control them with this additional app functionality, or do they have to be on wifi for this to work?

As long as smartthings is able to connect to the webcam it doesn’t really matter whether it’s connected via ethernet or Wifi, infact ethernet would be a more stable/reliable connection than WiFi.

Best way to confirm, If you’re able to connect to the webcam web login/interface from your browser it should work fine with smart things. First start with your internal lan ip address (check via browser web interface), then enter the same in the device preferences (and port), try turning on/off the IR LED’s, if that works fine then try to connect via external ip address/url.

If you’re using an external ip address to communicate make sure you setup port forwarding correctly and I would recommend not to use the default port 80 (since many ISP’s block it, sometimes it’s in use by other UPnP apps which override the router port forwarding etc). Use something like this:
HTTP -> 88
HTTPS -> 8888
ONVIF -> 888

These would have to be configured through your foscam web interface and also in your device code preferences (use the HTTP port there).


Thanks for Chris Jefferies for finding this. If your Snap (take picture) feature is not showing up on your ST App tile, see this message from him:

OK got it to work. my mistake, it was me. looks like if you don’t have it accessible via a public IP, the cam controls work, but the picture doesn’t. I made the camera public and the snapshot works. it doesn’t support SSL, so I didn’t want to do that. . . I’m going to try and proxy it through stunnel so the public communication is going thru SSL. I’ll let you know how that works.

Oddly enough,after making those changes, when I pointed the device config back to the LAN IP of the foscam, maintaining the (arbitrarily chosen) port I changed it to, the snapshots still worked.

Subsequently, I had it work and sometimes not work – especially if I tried taking a few shots quickly in a row.

When it works, the Live event logs for the camera device look something like this:

Executing hubaction on
Parsing ‘index:01, mac:DEADBEEFAAAA, ip:1BC1AF3, port:7A69, bucket:smartthings-device-conn-temp, key:123456-7890-1d34-beef-3445dddddddab’

When it doesn’t work, you never get to the Parsing line.

In further testing it shouldn’t matter whether you use an internal or external IP as the hub itself is making the http request to the camera to pull the image (I believe RBoy mentioned this at some point).

For security purposes, be aware that requesting the image from over the internet in clear http (e.g. in using an external IP for smartthings access) could easily expose your username and password for the camera. That said, so can using the foscam at all over the internet without proxying the connection. But it’s fine for playing around or testing – just make sure you use a throwaway u/p and are aware of the risk.

In any case, here are the things to try if it doesn’t work.

  • Try setting it up with the public IP – note that if your firewall doesn’t support loopback connections from the LAN, this probably won’t work.
  • Try changing to a port other than 80.
  • Restart your hub via the web graph interface
  • Restart the app – Make sure it’s dead – you can do a force stop in applications if you have android.
  • Restart the camera – As mentioned above by RBoy, sometimes the camera doesn’t respond correctly – though you can rule this out by attempting to browse to the Camera picture fetch URL directly from your web browser - http://IP address here:port/snapshot.cgi?user=alias&pwd=fakepassword

OK so once the app is working, there are a few other oddities. Sometimes the pictures just disappear out of the app. If you go back to the Event logs for the device you can find some names for the pictures it has taken. I’m not sure if these are accessible from somewhere else – maybe somewhere out on s3 storage. But once they’ve disappeared from the app, I haven’t been able to find them.

Also, it looks like the dns lookup function may be broken, as it wasn’t able to lookup a couple different dns names I pointed it to.

When it doesn’t work, I’m not sure if I should be blaming the android app, or slowness on the smart things side, but something is a bit screwy with that if the same settings cause different results. I’ve ruled out the code itself, my network connection and camera as the culprits when it happens, so have to find something else to blame.

In any case despite all that, I think it’s coming along nicely.