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

Ah, I have six identical Foscam cameras and this explains why some streams work and others don’t at different times depending on your internet connection.

1 Like

I got an issue where I wasn’t able to connect to my SmartThing App, I got “could-not-parse-the-service-response” for the whole week end. Support first suspected my Ecobee, but that wasn’t it.

Support came back to another user @Automatic00 having the same issue that the Foscam Device Handler was causing the issue.
After deleting it, I was also able to reconnect.

What do you think happened there?

No idea. ST architecture should isolate device handlers so this should never arise. Whatever it may be only support can get to the bottom of this. Though I am curious what’s going on.

@slagle any thoughts why one DH can impact another DH

Hi RBoy, thanks for the code and tips. But one question, If I want to use ddns and I have a port forwarding. Would be enought to set the ddns name in the IP field and the port? I try with that but didn’t work. So not sure how I should configure if I want to use DDNS+PortForwarding.

Thanks in advance!

BR,
Valentina.

I don’t know if it was clear my question. Better said. I have configure DDNS+Port Forwarding and I’m able to access to my camera from outside of my lan. I use it with foscam application, foscam app let you configure a host or IP, in my case I have a host similar to “xxx.ddns.net” port 88. I try to configure this on the new device I add using your code, but didn’t work. Instead of set the Camera IP address I set the hostname: “xxx.ddns.net” is that ok? If that so I’m not sure what I’m doing wrong becuase I don’t see anything after that configuration.

Tahnks in advance!

BR,
Valentina.

Yes it should work fine. I’m using it the same way.
Check your configuration again maybe there’s a typo somewhere. Does it work with the IP address? Possible that the DNS look ups failing since you’re using ddns. Check the logs

###Foscam Camera Universal Device Handler - version 3.2.4

  • Workaround for an issue with the ST platform calling the updated() handler randomly causing random issues (wrong state of flip/mirror and other ST app issues)

###Foscam Motion Alarm Monitor SmartApp - version 2.6.1

  • (no change)

Hey RBoy,
Looks like I got this working, but my camera image is under the “Take”, “Auto”, and “On” buttons with a large blank space at the very top. How can I get the video at the top where I assume it belongs (in the blank space)?

Depends on your ST app version and phone version. On the iPhone you get play button on Android you need to click on it and then click on the refresh button when it shows up.

Hi RBoy, thanks a lot for the answer.
Still get the issue but not figuring out which is the problem.

I try both configuration, using private IP address and using URL but nothing…
Device type seems to be fine…

This is what I see on log:

Using URL:

9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:33:22 PM GMT-3: error java.lang.NumberFormatException: For input string: “vazquezramirez”

Using internal IP:

9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:33:21 PM GMT-3: debug Taking Photo
ea3442e8-1609-48c6-a667-f62adf86dc75 10:33:20 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
ea3442e8-1609-48c6-a667-f62adf86dc75 10:33:01 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
ea3442e8-1609-48c6-a667-f62adf86dc75 10:32:55 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
ea3442e8-1609-48c6-a667-f62adf86dc75 10:32:46 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:41 PM GMT-3: debug /decoder_control.cgi?command=0&onestep=1&user=admin&pwd=xxxxxxx
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:41 PM GMT-3: debug Executing hubaction on 192.168.1.22:88
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:41 PM GMT-3: debug Device Network Id set to c0a80116:0058
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:40 PM GMT-3: debug /decoder_control.cgi?command=0&onestep=1&user=admin&pwd=xxxxx
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:40 PM GMT-3: debug Executing hubaction on 192.168.1.22:88
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:40 PM GMT-3: debug Device Network Id set to c0a80116:0058
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:39 PM GMT-3: debug /decoder_control.cgi?command=0&onestep=1&user=admin&pwd=xxxxxxx
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:39 PM GMT-3: debug Executing hubaction on 192.168.1.22:88
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:39 PM GMT-3: debug Device Network Id set to c0a80116:0058
ea3442e8-1609-48c6-a667-f62adf86dc75 10:32:05 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:00 PM GMT-3: debug /snapshot.cgi?user=admin&pwd=xxxxxx
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:00 PM GMT-3: debug Executing hubaction on 192.168.1.22:88
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:00 PM GMT-3: debug Device Network Id set to c0a80116:0058
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:32:00 PM GMT-3: debug Taking Photo
ea3442e8-1609-48c6-a667-f62adf86dc75 10:31:50 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:31:45 PM GMT-3: debug /snapshot.cgi?user=admin&pwd=xxxxxx
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:31:45 PM GMT-3: debug Executing hubaction on 192.168.1.22:88
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:31:45 PM GMT-3: debug Device Network Id set to c0a80116:0058
9f4e69d5-bd0a-4ad8-a5c3-be123c8691e9 10:31:45 PM GMT-3: debug Taking Photo
ea3442e8-1609-48c6-a667-f62adf86dc75 10:31:38 PM GMT-3: trace getPhrases(), state.welcomeIssue = null
10:30:36 PM GMT-3: info Waiting on events…
10:30:36 PM GMT-3: info For past logs for individual things go to the My Devices section, find the device and click on the Events link on the device information page.
10:30:36 PM GMT-3: info This console provides live logging of your SmartThings.

Here is some image of my issue:

Are you sure you’re entering this in the right box? Looks like you may be entering this where a number is expected (port?). Also filter your logs by the device, its’ very hard to understand with everything mixed up. From the looks of it your camera isn’t responding so either your configuration is wrong (port/ip/username/password) or your hub can’t reach your camera. See the first post for troubleshooting.

Maybe that error is from when I try to set the url on the ip. But then I tried also with internal ip but still the same issue. Maybe that is more clear with the image I have attached.

Thanks!

Hi @RBoy, I’ve been using the Foscam 9821 with your device handler and smart app and it has been great. Recently I added a Foscam R2 (Full HD) and am having trouble. While I can create a device for the R2 using the device handler and have mostly everything working (e.g. live streaming), it was giving me problem with the motion detection. The web app for this camera appears to have slightly different UI on the motion detection where it can take 3 zones and the user can mark each zone and assign “Lowest, Lower, Low, Medium, High” on each zone. The problem I observed was that whenever the device handler activates the camera for motion detection, it will update/erase the motion detection settings such that zone 1 & 2 will be turned off (boxes unchecked), and zone 3 will be turned on with full frame set to whatever sensitivity level the user has set on the device handler. Unfortunately, the R2 camera will not activate the motion detection under these zone settings. It appears that the other zones (1 & 2) must be activated in the web app settings before it can detect motion. Would it be possible for you to update the device handler to support R2 with zone 1-3 sensitivity settings? Or just add an option in the device handler to avoid changing the zone sensitivity settings (i.e. just use whatever was setup in the web app)? The R2 is a great camera with 1080p resolution, and I would much appreciate if you can update the device handler/smart app to support it soon :slight_smile:

UPDATE: I did some more testing and verify that at least zone 1 must be turned on in order to activate motion detection. It seems that the zone activation must be set in correct order, i.e. if only one zone is needed, then it must be zone 1.

In the device preferences the last option is motion detection area settings. Enter your own string here to set the motion detection area as you’d like to have it.

Thanks for the response @RBoy . Can you please tell me the exact parameter I need to use there? On the R2 web app, we first need to set the location and area of the three zones, ENABLE the zone, and then set the sensitivity (individually for each zone). I tried erasing the the parameter in the motion detection string and use only “area0=1023” or “area1=1023” but it still behaves the same. Is there any instruction on how to use the motion detection string? Or can you please tell me the exact string I need to try if I want to:

1). Select Full frame in zone 1
2). Enable zone 1
3). Set Sensitivity to “Low” for zone 1

Here’s a screenshot of the R2 motion sensitivity screen looks like:

Sorry, you’ll have to refer to the foscam forum to get the details and the string, once you have it you can put in there.

Thanks @RBoy. I was able to locate the Foscam CGI User Guide and modified your code to create a temporary version for the R2. It appears that Foscam has added a new API “setMotionDetectConfig1” to handle cameras that support multiple motion detect zones, and those zone-related parameters are only applicable to the setMotionDetectConfig1 API. Since my update was just a quick patch to make it work specifically for the R2 and is not backward compatible with the older models, would it be possible for you to incorporate the new API with an option selector in the UI to support the newer cameras that have multiple zones?

1 Like

I’ll look into it, not making promises. DH’s don’t support dynamic menu’s and I’m worried about the number of options already since ST’s mobile apps break more stuff than they fix and DH options aren’t a popular standard. I would need to rewrite the entire DH using a Parent Child SmartApp DH mode to make it truly flexible. At the time I’ll encode this stuff in.
Are you referring to the standard CGI doc or a special one for the R2?

I believe it’s just the standard CGI.

One weird thing I found with the device handler is that the live streaming would work only if I use the DHCP assigned IP. If I change the IP to another fixed IP that I prefer to use, the live streaming won’t work in device handler (but it can still take picture or activate motion sensor). I can still use the fixed IP, but it has to be the same IP that was originally assigned by DHCP. Other IPs work perfectly fine outside Smartthings device handler and I can get live streaming in the Foscam web app. Don’t know why live streaming works with only one IP.