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

I have not been able to get it to work. But I haven’t tried to contact ST yet either.

Hi Guys,

While we provide an environment of freedom for people to create solutions and use community created code, SmartThings is not responsible for support for anything that doesn’t go through SmartThing’s application approval process. We do this to ensure it follows protocols, to also ensure it plays nice with our servers, and a level of quality.

In this instance, @HixVAC actually worked with our support side, and we’ve looked into the logs. Foscam doesn’t expose their motion detection capability, instead there is an alarm capability that a community user has tried to use as a workaround for the motion detector. However, it is currently hitting the limit of the polling limit we have, making the SmartApp inoperable.

If you are being charged for a SmartApp that isn’t through the official SmartThings submission process, please work with the 3rd party provider in resolving an issue.


1 Like

Thanks @April!

@RBoy, could you look into the issue and post a fix to help here…or perhaps it’s not even possible?

@HixVAC (and @April)

First of all the app and the device are working PERFECTLY! Infact after reading this post I just went back to my own cam which I’ve installed, turned on the monitoring, walking in front of the cam and it set off the ZWave alarm just like it’s supposed to do. So yes the app works ABSOULTELY as it’s supposed to work.

Second, I have not idea where @Brad_ST/support get their information but it’s nonsense! Foscam ABSOLUTELY exposes their motion sensor capabilities in their SDK. You need to sign up for their developer program (which is a nice and lengthy process). Using the SDK one is able get the status of the alarm which is thereby used by ST to invoke events (using the motion sensor capabilities). There is no “workaround” being used, these are documented API’s.

Third, there is no “spamming” or any such nonsense going on. The SmartApp is using the API’s published in ST to communicate with the camera while its is an armed monitoring state, once the monitoring state is disabled the communication with the camera stops. BTW this architecture is EXACTLY what ST also recommends in it’s developer guidelines, differences between device and smart apps. That’s EXACTLY why there needs to be a Smart App and not just a device, is because ST recommends that’s the way to do it.

I hope that puts to rest any question about the architecture.

Coming to your specific issue - you appear to have a Smart App “installation” issue from what I see above. I don’t see what that has to do with the architecture? Every now and then I see issues even with store “published” smart apps that fail to initiatlize, infact this issue has been known for years if you search the forum you’ll find folks who have had failure installing smart apps, updating their settings and often it resolves itself or sometime they have had to resort to have ST support forcefully delete the apps at the backend (because the platform won’t even it allow them to delete it).

So can you help me understand are you facing an installation issue or is the app not capturing the motion detection event?

Hey @RBoy; thanks for the quick reply.

The issue at hand currently is the SmartApp won’t load via the SmartThings app (Android to be specific, not sure that’s relevant).

Once it’s “created” here, it can be removed via the following method:
My Locations -> List SmartApps (at the bottom of the screen) -> Edit -> Scroll down and remove any/all Foscam Motion Alarm Monitor SmartApps
but even after removing the app (or apps if you clicked it multiple times), trying again only results in the same issue.

So for one reason or another it seems like the app isn’t getting instantiated successfully.

@HixVAC check out some of these links where folks aren’t able to uninstall/delete the app:

I understand your frustration (trust me, I also go through it). I’m not sure if it’s a issue with the Android ST app or just the platform. Did you update your app recently? If you see all the links below you’ll also see that ST support blames the developer when they can’t “figure” it out. I’m using the iPhone to test the apps right now. (which BTW has it’s own set of bugs that I’ve reported to ST, like I said with each release they break something).

I’ll try to help you get to the bottom of this as much as I can given the “support” you’re getting from the official ST folks.

Try a few things:

  1. Delete the app completely from your IDE
  2. Download the app again from the server and copy it (make sure you copy it correctly). Some folks had an issue because while copy pasting/saving they accidentally deleted/missed a line. (human error)
  3. Kill your Android ST app, restart it and try to add it again
  4. Open your live debugger in the IDE (before this next step)
  5. Try to install app on your android. Check the live debugger for output, if the app has an issue (bad code etc) it will show up on the debugger as an error

Post back what you see

@HixVAC check this out, surprised that @April didn’t point you to this:
Looks like the same error you’re facing on Android:

Can you try to roll back your Android ST app to an older version (1.7.0 or 1.6.9) and see if you’re still facing the issue?
@tbotuain can you also try to use an older version of the Android ST app?

Added a new feature for the Foscam Motion Alarm SmartApp:
On request from users added an option to reset the Foscam camera to a preset position after the motion detection has been disabled.
So when combined with cruise function it will work like this:
-> Motion detection turned on (via device)
-> Motion Detected, alarm set off and cruise action started
-> Motion detection turned off (via device)
-> Camera resets to selected preset position

Here are few snaps taken today of what it looks like as requested (when my dog set off the alarm):

This is the logging I get when trying to install the app:

######### 9:20:56 PM: trace Preset names -> [null, null, null]
######### 9:20:56 PM: trace Getting present names from camera null
######### 9:20:56 PM: trace Cruise names -> [null, null]
######### 9:20:56 PM: trace Getting cruise names from camera null

Not sure if this helps at all :-/ I also gave a shot of reinstalling the SmartApp in the API a couple of times before, and a new time tonight with the new version; unfortunately still the same result. I’ll poke around and see if I can find an older version of the app to play around with next, but not sure where I could find it.

Found 1.6.9…unfortunately it was also the same result on that version as well :frowning:

That’s perfect, so the app appears to be initializing. the null indicates that you haven’t entered any Preset name in your Foscam Camera device (preferences).

Check one thing, make sure you’re using the latest device type code (you can just copy paste the latest one of the existing one and then hit refresh in the camera device to load the latest settings).
Try entering a preset name in your camera device preferences and then reinitialize the app and you should see that present name pop up here in debug log.

Honestly here is what I think may be happening. This is purely based on my recent experience with the ST App on the iPhone. My devices were working perfectly with the current iPhone ST app. Then ST “upgraded” the platform and the same app version, the device preference page broke (see the forum I’ve posted the details). ST claims the upgrade was necessary but it broke a working app, the only option is to wait for the new version to come to “fix” the issue.

I suspect something similar may be happening here with the Android. The Smart App is filled with dynamic preferences and my suspicion is that the rendering is failing due to some recent change at the backend.

I’ll send you a customized version with all the “fluff” like paragraph commands etc removed. See if that works, we will just need to try a few things to see why ST “rendering” is failing.

@HixVAC thanks for your patience/help in getting to the root cause of the errors. Looks like ST is at it’s very best these days (from dev to support :smile: ) @April

For everyone, there’s a bug in the Android ST app which causes the rendering to fail and app to error out with the message shown by @HixVAC. For those interested in the issue is that if the enum contains an empty list the Android app craps out! However the iPhone app works just fine and shows an empty list. I’ll post this in a separate thread.

I’ve put a patch in for the Android bug. @tbotuain @Kyle_Wiggers please download the latest version of the Foscam Motion Detection Smart App.

Thanks for @HixVAC I was also to further optimize the Foscam Device type, the trigger internal is now hardcoded to 15 seconds to provide the “slow” ST platform enough time to communicate with the device.

Also a key point to NOTE, the Foscam Motion Detection Smart App ONLY WORKS WITH HD CAMERAS for now. SD Camera’s have a different way to detect motion for which OAuth needs to be enabled in the Smart App, that work is under way but it’ll take some time to get that functionality built in. Will keep you all posted.

Folks - For everyone who’s Foscam are NOT able to communicate with the SmartThings Hub, (cannot connect, not seeing Blue lines in the debugger etc). MAKE SURE YOU’VE SELECTED THE HUB IN THE DEVICE SETTINGS.

If this step is NOT completed, SmartThings hub WILL NOT communicate with your device (security).

Goto to My Devices -> Select your camera -> Scroll down to Edit - > Scroll down to Hub and select your Hub. Make sure this isn’t empty.
If this field (Hub) if empty SmartThings will NOT communicate with your Foscam.

Okay with much pain and effort and digging through archives of documents and information I’ve managed to figure out how to get the SD Foscam camera’s to report Alarm Notifications to the ST platform. Infact they have a much better mechanism but due to ST limitation I am using alternative method similar to the ones for HD cameras. Will enable the alternative option sometime in future once I’m able to figure out how to get past the ST/Foscam limitation.

Meanwhile please find the updates with also some bonus new features for SD cameras (tested with FI9810W).

  1. Support for Motion Alarms when using the Foscam Motion Alarm Monitor Smart App
  2. Added support to the device type also supports configuring the Motion Sensitivity for SD Cameras (like HD)
  3. Added support to the device type for enabling eMail notifications for SD cameras also (like HD)
  4. Added support for enabling option to upload snapped pictures to the FTP (similar to HD option to snap picture)
  5. The button now reflect the current status instead of expected status, so while they are slower to respond they represent the accurate status of the camera settings
  6. Fixed a bug with the reboot button for SD cameras

The SmartApp and Device now support Push and Pull notifications but the Push notification is disabled for now and will be enabled in future for SD cameras (unfortunately HD cameras dont’ support Push notifications)

Make sure you update both the SmartDevice AND the SmartApp for Foscam AND don’t forget to hit REFRESH in the Device and Reinitialize the SmartApp after updating the code for it to work properly.

Added the following enhancements to the Foscam Motion Alarm Monitor SmartApp

  1. Ability to select Modes for Monitoring for Alarms (when in a mode that’s not selected it will not disable the Alarm Monitoring on the camera but will not report it to ST)
  2. Enabled option for Push Notifications for SD cameras, there’s an option provided to use Alternative Method of Alarm Detection (i.e. disable Push and use Poll instead). Use this if your SD camera is not able to send Push notifications for whatever reason
  3. Added option to Start/Stop the camera cruise when an external alarm is set off (so when coupled with enabling the monitoring this can act like a recording device for your house when an external alarm goes off. Make sure you configure your other SmartApps to turn on the camera alarm monitor when the external alarm goes off)

Key point to note for SD camera’s, if the default Push Detection for Alarm is not working, Enable the option for Alternative Alarm Detection in the SmartApp


Fixed an issue with SD camera’s not reporting the Motion Alarm. Use the latest device and SmartApp. Make sure you refresh the device and then re initialize the smartapp in that order after updating the code.

Finally managed to get Push Alarm notifications working for cameras that support it (MJPEG/SD). Updated the Foscam Motion Alarm Notification SmartApp. Make sure you have a valid DNS settings on your camera for this to work.

Created Device type Foscam IP Camera
Created Device “Office Cam” for my Foscam 18918W camera
In the ST “Things” page, tested camera features such as “Up”, “Down”, “Take Picture”. All work fine
Loaded the App “Foscam Motion Alarm” selected the Office Cam., turn on light when motion
Tried to exit and app crashed. "Failed to save page"
Tried both on Samsung S6 and Ipad 3…

No idea where to go from here.

Going from bad to worst :rage:

I installed the “Trigger to take picture” app and it works fine. Unfortunately, I had this idea if I were to starts from scratch I might have better luck with the “Foscam Motion…” app. I uninstalled one of my cameras, recreated the camera device then tried to take Picture. Nothing… It also does nothing in the “Trigger…” app. I can however, move and/or reboot the camera. I compared setting with one of the other cameras (also Foscam IP Device type) and cant see any difference other than IP (& network ID)… I have rebooted the camera but nothing…

Okay so it’s always good to hear about issues it helps figure out where the instructions aren’t clear. As dev’s we tend the repeat the process so often it becomes second nature for us.

First up, I’m pretty sure you’ve read through the thread to realize that the not saving issue is a ST app/platform problem. It’s not an app crash but a rending issue/metadata saving issue… You would have also read that the picture not showing up is a communication issue between the camera and the hub. If either one runs slow it times out and hence no picture. The best bet is to reboot the camera / hub. It is also highly likey it’s a corrupted installation in which case you need to change the IP address/port (and NO reinstalling the device will NOT work, see below for details, ST platform has a memory so you need change the IP address/port).

However in our testing here at the labs we found that the SD camera’s firmware are more unreliable than the HD camera’s and tend to freeze/lock up/lose connection with WiFi every now and then.

Having said that I decided to try it over from scratch and follow the exact instructions written on the website. I realized there was a missing step and also updated the website. So check out the website, however I’ll walk you through a few things.

  1. Make sure you’re running the latest code for both the SmartDevice and SmartApp. Both are currently at version 2.1.4 (it’s written at the beginning of the code)
  2. Start with the Camera, once you have installed the latest device code, click on Refresh first to load the settings
  3. If your camera movement works (up/down) then the setup is correct. If not check your username (case), password, IPaddress and port. If there are still issues it could be to do with the communication speed/stability as mentioned above. Also ensure your camera and hub are on the same network and accessible to each other. Usually a reboot fixes these issue. I’ve found that the 9810 doesn’t seem to like one of the routers we use here in our lab, it works great with the other. So check it out, use a lan cable to rule our WiFi issues.
  4. Change your camera ipaddress or port. IMPORTANT STEP. As pointed out in a few posts above we’ve seen that once in a while an installation gets corrupted (god know why like many thing on this platform), but the important thing is that ST has some sort of a memory. It remembers the IP address/port combination for a particular device. As long as it remembers that unique combo the device will ALWAYS remain corrupted until you change the IP Address or Port of the device. A typical symptom of this issue is the motion (up/down/cruise) works but the Take Picture does not and neither does motion alarm!. Looks like you are facing this issue, so go ahead change the IP address or port of the camera (any one is fine) and then change the settings in your device preferences page (you don’t have to reinstall it). That usually fixes the image issue and other seemingly “random” issues like I cannot turn on the Alarm Monitoring features.

After starting clean I following the above steps (AND BTW I ran into the SAME not taking image issue, change the port and IP address and it worked perfectly after that! Then I checked the Foscam Motion Alarm SmartApp and enable the motion alarm and walk past the camera and I got a notification.

Hope this helps!