Generic Camera Device using local connection (new version now available)

@jotto It is possible that there is some sort of limit on camera jpeg image size? It would also matter how fast your connection is, since it has to send the image up to amazon s3 and back down to the app.

I don’t know the mobotix too well, although they are on my wish list, but I wonder if there is a way to get a smaller image?

Can you save the image resulting from the path /control/userimage.html and post it or email it to me?

Also, does this require authentication? If so, how does it work when you hit the ip/path via a browser? Does it pop up a username password box or does it have a login page?

@tslagle13 sorry Tim, no way that code will work with a local ip.

I might have to pick up one of these camera’s to test with, or are you willing to port forward it temporarily so I can access it remotely?

I know that. I was more or less providing it so you could see how the image was being pulled and stored.

Maybe @imbrian can chime in here.

@tslagle13 Tim, since your camera must already be port forwarded for this code to work, would you mind sending me via message the ip and a user / password to test with? I want to capture the request headers and response data to see what’s going on.

So Foscam’s do not use POST they use GET. Hope that helps people…

Also, I was able to test the method used for that external image and it looks like the S3 usage in my device is required for hubAction local commands because the hub truncates long responses.

So it is possible that there could be some upper limit on size of images. I don’t have hi-res camera to test with…

If anyone is willing to port forward or teamviewer session with me I am happy to try to get your cameras to work with my devicetype. I’m very confident that if you can view an image in a browser, this devicetype can grab it locally.

Here is one you can play with

IP address:
Port: 8094
User: temp
Password: test
URLs will be the same as the ones listed in @tslagle13 post (I am also using that device type).

I will leave this user account active and port forwarded awhile for you to test. The camera is in an outdoor cat house for a neighbor cat we take care of in case anyone is wondering.


Thanks for the test, works great with my generic camera device type.

I took two screenshots, one of the camera interface showing the frame that was captured and the second the configuration to make these foscam camera work.


What’s strange is I can’t do it with either an internal address or the external address I provided above. I am using the device type code in the GitHub link in the first post. I just pulled it again in case there were any changes and still nothing.

Is that the same code you are using?

I’m thinking its gotta be a port forward issue. I’m gonna do some trace routing tonight when i get home.


What is your network setup? Just for fun i’d like to see what you are setup as.


I am not doing anything too exotic.

I have 3 Foscam cameras set-up on WiFi and 7 Q-See cameras running on POE. They all have fixed IP addresses set-up on the router side (i.e. the router always issues them the same IP address).

I don’t port forward any of them on a regular basis. When I want to access them remotely I VPN in. When I do port foward, I always map a different external port to the camera (in the case above, I have the router mapping port 8094 to port 80 on the camera).

Using @imbrian device type, I can access all of the Foscams with port forwarding but not with the internal IP addresses. I don’t care about the camera above, but the other cameras aren’t ones I want open to the Internet.

There is an official Foscam device type that I can access the cameras with the internal IP address (just need to set the Network ID to hex ip and port number) but it has way less functionality than Brian’s device type. I have the URLs I need to integrate my Q-See cameras but not the programming skills to modify the Foscam device type. That where I am hoping this device type can be made to work.

The ultimate solution would be to utilize ONVIF for camera discovery. In my layman terms, ONVIF works like UPNP for cameras. ONVIF is supported by the newer Foscams, Q-See, Axis, etc… and would allow SmartThings to automatically find and integrate all the cameras on the local network.

1 Like

It is possible that somehow my hub has access to S3 and others do not. But since some have had luck and other not, it might be the port forward issue @tslagle13 is referring to.

The good news is it works for me :slight_smile: The bad news is everyone’s network setup is different, so much for plug and play…

I haven’t found a camera type that doesn’t work if you can load the image in a browser.

But my current device tpye pulls it just fine. and yours does remotely. so… its gotta be an internal thing for all of us

Im gonna striup down my network to the bare essentails when i get home and see what happens.


Hey, what did you do to fix this error yesterday?

I am getting some good results with another device type but don’t know how to fix this.

java.lang.StringIndexOutOfBoundsException: String index out of range: 8 @ line 204

For whatever reason that function to convert hex to ip is wrong. So I just took the user IP and port and used it rather then round tripping it back.

Haven’t had time to build a correct hex to IP convertor. None of the existing functions do it properly.

Hello, I’ve been trying to use this code to send GET commands to a Smartlinc controller (2412N) in order to add X10 control to SmartThings, the smartlinc controller responds with B1 Off command when I open on my local network, I’ve been trying to use this script to send a GET command:

sendHubCommand(new physicalgraph.device.HubAction("""GET 3?$off=I=3 HTTP/1.1\r\nHOST: $ip3\r\n\r\n""", physicalgraph.device.Protocol.LAN, "${deviceNetworkId}"))

Assuming that I already defined $ip as, and $off as 0263E600P10263E280 in the settings of a personal SmartApp that activates each time I turn off a virtual switch, Can anyone help me with this coding, I get no error, but the Smartlinc does nothing. Thanks!

Add the following code below or a over that line and tell me what your deviceNetworkId is

log.debug deviceNetworkId

I’m afraid I’m missing lots of things, tought it was simple, When I request the devicenetworkId i get null:

22:08:17 CDT: debug null
22:08:17 CDT: debug Executing GET 3?0263E600P10263E280=I=3 HTTP/1.1

on INP via sendHubCommand

Ok, so this is getting really frustrating…

Removed my firewall and DMZ. reset my router to defaults. still cannot get the image to load… what is going on?!

Only thing I can think of now, is something is not right on your hub compared to others?

Remember the firewall rules, it needs to grab the local image requests from hub to camera, hub then sends image up to cloud. Could something be blocking the hub outbound to amazon s3?