Android IP Camera Device

This is a custom device type. This works with the Android IP Camera app. It allows you to take photos, record video, turn on/off the led, focus, overlay, and night vision. It displays various sensors including battery level, humidity, temperature, and light (lux). The sensor data is all dependent on what your phone supports.

  1. First you must create the device type:
    https://graph.api.smartthings.com/ide/devices.
    Copy this code there.
  2. Then you must create the device:
    https://graph.api.smartthings.com/device/list.
  3. Install the app on your phone.
    https://play.google.com/store/apps/details?id=com.pas.webcam.pro.
    I recommend the paid version, but the free works as well.
  4. You have to adjust your router settings to allow the port to be forwarded to your phone.
    I set up static ip addresses for my phones with different ports forwarded. (ie 8091, 8092, ā€¦).
  5. I also installed the paid version of dropsync.
    https://play.google.com/store/apps/details?id=com.ttxapps.dropsync.pro.
    This will allow you to upload the videos/photos to a custom dropbox folder.
    My setup is /IP Camera/{the camera name}.
  6. Dont forget to setup the device in the smartthings mobile app. Use your external ip address.
    http://www.ipchicken.com will give this to you.
  7. Also if you use this with the Action Dashboard:
    ActiON Dashboard 4.6.3 is here! (Now SmartTiles.click).
    You will need to set the url to ā€œhttp://username:password@{hostname or ip}:port/videoā€

Hope you like it. Feel free to provide feedback.

8 Likes

I speculate the problem may that you are using the same state variables or values (on/off) in multiple Tiles.

But the code looks sensible. Maybe experiment around my speculationā€¦

1 Like

How do you use this? Does this allow an Android device with a camera to be a ST camera?

If so, how do I connect the Android device?

Thanks!
-Todd

Thanks @tgauchat , That fixed it, the code is updated and fully functional.

1 Like

@Todd_Whitehead I have updated the OP with the necessary info.

Which android app is it?

This one:

@pstuart yes, thats the free version. I again updated the OP with the playstore links. :smile:

I wrote an app to work with this device. Check it out.

1 Like

Hey @rob_a_landry, thanks for putting something like this together! Iā€™m trying to get it it work but itā€™s just not working correctly for me yet. I am using an old Samsung GS3 for the camera/device. I created the device type in IDE, then created the device, downloaded the free version of the IP Webcam onto the SG3, found the internal IP address, forwarded a HTTP port on my router from that IP address (made it 8081), checked the external IP of the SG3 and put that into the ST preferences for the ST app, and I still cannot get it to work. I started a stream from the SG3 IP camera app, and used the phoneā€™s internal IP address and port to open up a browser window. I can get to the settings on that window, but nothing else seems to work. In the ST settings, I tried both the internal and external IP address, the port number I forwarded and the remote port that showed up on IPChicken, and still nothing. When testing, I would try to take a photo from ST app, and sometimes it would freeze up, but no photo ever showed up on ST.

Is it required that we use something like Dropsync? Is that my issue? From the OP, I thought it may be optional. I was hoping to just see a stream on my ST app dashboard and then, hopefully, set it up on SmartTiles. Am I doing something else wrong setting up the IPā€™s or with port forwarding? Any help would be much appreciated!

My goal is to have a tablet and a phone mounted in the house running SmartTiles/ActiON, and also have both of those run this IP Camera, as they will be mounted where I need cameras. Thanks!

Iā€™ve got it working with an old Droid Razr. Did you verify that you can get to the browser interface through the external IP (not using SmartThings)?

Thanks to @rob_a_landry for sharing.

I am totally guessing here that httpGet in the code below will run in the cloud and not on the hub. Thus the need for the external IP address.

httpGet("http://${username}:${password}@${url}:${port}/photo_save_only.jpg"){
	httpGet("http://${username}:${password}@${url}:${port}/photo.jpg"){
		response -> log.info("${device.label} image captured")
		parseCameraResponse(response)
	}
}

I tried to rewrite the code using hubActions, but I could not get the two requests to ever produce a picture. I tried doing a GET followed by a delayed hub action followed by the final GET.

The reason I would like this to use hubAction / parse() is that the code will then run on the local network and I can close the hole on the firewall. I donā€™t need live streaming for this application, and I donā€™t like to open up unnecessary holes in the firewall.

nevermind :slight_smile:


This is great thanks for taking the time and effort to do this.

I do have a question - when creating the device what do I out under ā€œdevice network idā€? I had the full address, what I can type into my browser to see the camera. Then in all I put the ip and the port separately. Iā€™m not getting an image though, no connection it seems. I have it forwarded and working in a few different apps and devices so I know the forwarding is functining the way it should be.

Also, does it matter if my port forward is set to https rather than http?

If I understand this other post correctly, the network device id can be anything as long as its unique. The author says keep it short, sweet, and descriptive:

Iā€™ve managed to get through step 3 successfully. Iā€™ve never played with port forwarding, though, so Iā€™m still muddling through this.

@Dan999 - I would love to see this option. Did you make any additional progress?

I gave up on using a phone. I needed a camera in the garage, which is not air-conditioned, and I think the phone kept rebooting when it got too hot. I replaced the phone with a ā€œrealā€ IP camera that I got at Costco, using another IP camera device available from the community.

hi
I was triying to install this app but I am getting erros
Ɨ Org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: script1442926809777964417830.groovy: 114: expecting ā€˜)ā€™, found ā€˜backgroundColorsā€™ @ line 114, column 8. 98 backgroundColors:[ ^ 1 error

please help me I am new to smartthings

Try installing it as a device not a smartapp.

successā€¦thanks for the replay

How much of a problem is it to have the password exposed in the URL like that?
I meanā€¦itā€™s a problem.

I know this is just experimental and all, and I really like the concept, but do you have a plan for making it more secure (or is there anything we can do on our end that Iā€™m not thinking of) in the future?

Due to the way httpget works i think this is the only way. Honestly i havent used this setup in months, but i could try setting the username and pwd in a header and see the results. Hang tight and ill tinker.