Android IP Camera Device


(Rob Landry) #1

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.


Using an old phone or tablet as a webcam
IP Camera Suggestions for ST?
Where is the IP camera support?
ActiON Dashboard 4.6.3 is here! (Now SmartTiles.click)
Is imageCapture capability not supported anymore?
Camera Record App
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

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…


(Todd Whitehead) #3

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


(Rob Landry) #4

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


(Rob Landry) #5

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


(Patrick Stuart [@pstuart]) #6

Which android app is it?

This one:


(Rob Landry) #7

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


(Rob Landry) #8

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


(Cody Willner) #9

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!


(Dan) #10

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.


(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #11

nevermind :slight_smile:



#12

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?


(Jason F) #13

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.


(Jason F) #14

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


(Dan) #15

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.


(mathew) #16

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


(Patrick Stuart [@pstuart]) #17

Try installing it as a device not a smartapp.


(mathew) #18

success…thanks for the replay


(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #19

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?


Need help using ActionTiles - Tablets/Smartphones as still or video cameras
(Rob Landry) #20

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.