How can we collaborate together?


(Chris LeBlanc) #1

Now that we can share our SmartThings apps are there any thoughts on how we can collaborate together? I mean sure, we can go find code to rip off from another shared app and build our own app to do something but we would never collaboratively improve on a single app.

I ask this because it seems I’ve created an app that was already created by @jnovack which auto locks doors after unlock on a timer.

@jnovack if you are out there, my app has a few more configuration options (Lock It After A While) so I’m not sure how or if you’d like to collaborate, maybe on your Github repo (https://github.com/smartthings-users/smartapp.auto-lock-door/blob/master/auto-lock-door.smartapp.groovy). My code is in the shared code pile.

It’d be nice to set some conventions (especially for app naming so we can easily find duplicates). Please chime in.

– Edit –

Another random thought, almost like this forum system searches for related topics before you attempt to create a new one, it’d be cool if the dev system attempted to find a preexisting app with a similar name that may do what you were going to build already.


(Csader) #2

Hi @leblaaanc, that code on @jnovack’s github repo is actually mine (see the Author label). I’d love to see what options you’ve added to the code. Can you post it here?


(Chris LeBlanc) #3
/**
 *  Lock It After A While
 *
 *  Author: 	Chris LeBlanc (LeBlaaanc)
 *  Email: 		chris@leblaaanc.com
 *  Date: 		05/22/2014
 */

definition(
    name: "Lock It After A While",
    namespace: "LeBlaaanc",
    author: "Chris LeBlanc",
    description: "Locks a lock after a given period of time of being unlocked.",
    category: "Safety & Security",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience%402x.png",
    oauth: true
)

preferences {
	section("Choose lock(s)") {
		input "lock1","capability.lock", multiple: true
	}
	section("After this many minutes") {
		input "after", "number", title: "Minutes", description: "10 minutes",  required: false
	}
    section("While I'm present") {
		input "presence1", "capability.presenceSensor", title: "Who?", multiple: true, required: false
	}
    section("Notification method") {
    		input "push", "bool", title: "Push notification", metadata: [values: ["Yes","No"]]
    }
}

def installed()
{
	subscribe(lock1, "lock", eventHandler)
}

def updated()
{
	unsubscribe()
	subscribe(lock1, "lock", eventHandler)
}

def eventHandler(evt)
{
	def delay = (after != null && after != "") ? after * 60 : 600
	runIn(delay, lockTheLocks)
    log.debug("runIn(${delay}, lockTheLocks)")
}

def lockTheLocks ()
{
	def sombodyHome = presence1.find{it.currentPresence == "present"} != null
    def anyUnlocked = lock1.count{it.currentLock == "locked"} != lock1.size()

	if (sombodyHome && anyUnlocked) {
		sendMessage("Doors locked after ${after} minutes.")
		lock1.lock()
        log.debug("Attemped to send message and locked locks.")
	}
}

def sendMessage(msg) 
{
	log.debug("sendMessage(${msg})")
	if (push) {
		sendPush msg
	}
}