Dropbox Motion Sensor (Swann DVR)

Hi

I’m brand new to smartthings, so please bare with me

I have been trying to find a way of using my existing cctv system as motion sensors within smartthings.

There is no native webhook or api capability for my DVR (Swann 4980), the only capabilities are email alerts and dropbox uploads on motion.

I tried the email route and had it working through IFTTT, but because of a limitation within the dvr that stops it from spamming emails it limits the alerts to 1 per minute across the whole DVR, so a motion alert on my driveway would stop a motion alert in my back garden.

I have now turned my attention to using dropbox

I have created my own smartapp, and I have it mostly working heres what it does

  • I have setup a virtual switch for each of my cctv channels (e.g ch1,ch2 etc etc)
  • I have configured a dropbox app to send a web request to smartthings every time there is any change within the dropbox account
  • On receipt of web request, my app will call back to dropbox api and check each of the channel folders for files with a timestamp within the last 2 minutes, if it finds one I turn that switch on

This is all working from the simulator but I have a few questions (that i’m hoping you can help me with)

  • When installed through the app instead of through the simulator how do I get my apps URL and token (for me to set in dropbox)
  • Instead of me using switches (i havent yet figured out how i will trigger them back off) is there a way for me to use motion sensors instead?
  • I have written my app directly in the ide, is there a better ide than the web one? Is there a guide for moving this into github?
  • Could I have done this in any other way?

Thanks Lrmulli

This is the app I have created so far, for reference (please excuse the untidiness) and remember i’m very new to smartthings

Dropbox webhooks

Thanks

I have answered one of my own questions,

When installed through the app instead of through the simulator how do I get my apps URL and token (for me to set in dropbox)?

I added the following to my initialize method, which allowed me to grab my url for dropbox from the logs

if(!state.accessToken) {
	// the createAccessToken() method will store the access token in state.accessToken
	createAccessToken()
}
log.debug "Access Token: ${state.accessToken}"
log.debug "App ID: ${app.id}"
def appUrl = "https://graph-eu01-euwest1.api.smartthings.com/api/token/"+state.accessToken+"/smartapps/installations/"+app.id+"/webhook"
log.debug "App URL for dropbox: ${appUrl}"