Pairing a Vistacam

And here is a private message I had sent to another user on how to get his foscam set up using the above code:

Yes – you first need to add a custom device type. That will define what your inputted device is and how it works.

  • Visit https://graph.api.smartthings.com/ide/devices and click ”New SmartDevice” in the upper right corner.

  • Give it the Name of ”Foscam” – author can be whatever you want. In ”Capabilities”, select ”Image Capture” and ”Polling”.

  • Under ”Custom” enter these attributes: ”setStatus” and ”alarmStatus”.

  • Under ”Custom” enter these commands: ”alarmOn”, ”alarmOff”, ”left”, ”right”, ”up”, ”down”, ”pause”, ”set”, ”preset1”, ”preset2”, ”preset3”, ”toggleAlarm” and ”preset”.

  • Click ”Create” – it’ll drop you to the coding IDE. Just paste in this source code: https://raw2.github.com/imbrianj/foscam/master/foscam.groovy

  • Save and Publish

  • You now have the custom Foscam device type installed – you’ll need to install your specific device. You’ll need to have a port open to access it from the ST cloud. Once it’s configured to accept connections externally, go to ”My Devices” and click ”New Device”.

  • Enter the ”Name”: ”Foscam”, ”Device Network ID”: ”Foscam”, ”Type”: ”Foscam”, ”Location”: wherever the device lives, ”Hub”: LEAVE EMPTY.

  • When you’re a the details page for this devices, there’s a ”Preferences” section near the bottom. Click ”edit” and enter your username, password, IP address (or dns address) of the camera as well as the port used.

  • You should now have the device installed and it should be able to respond to events.

The foscam.groovy is used to tell SmartThings how to turn the alarm on – but you’ll need a smart app (or direct interaction with the app in the menu) to actually arm it. You can create a new smart app and take my code here: https://raw2.github.com/imbrianj/secure_my_foscam/master/secure_my_foscam.groovy and configure the app to arm or disarm based on a particular mode (the most logical being ”arm” for away, ”disarm” for home).

Hope this helps – let me know if you have any questions.