Just a couple days ago I bought two Hubitats to make a transition within the company from ST. Liking it quite a bit so far.
Under ST I was using ethayer's device driver for the lock with good results, but under Hubitat and the schlage driver included in 2.1.1.122 I get a null object returned when subscribing to code changes
ie, this code works with ethayer worked but under hubitat the code is called but the passed evt is null
def codeUsed(evt) {
log.trace "In code used lock"
def lockId = lock.id
def action = evt.value
data = new JsonSlurper().parseText(evt.data)
...
}
I am trying to get the slot number used. Any ideas?
Thank you
I think this is what you're looking for?
app inputs:
input(name:"keyPads", type:"capability.securityKeypad", title:"Select keypads", multiple: true)
input(name:"locks", type:"capability.lockCodes", title: "Select locks", multiple: true)
app subscriptions:
subscribe(keyPads,"securityKeypad.disarmed",useHandler) //usage accounting keypads
subscribe(locks,"lock.unlocked",useHandler) //usage accounting locks
app event handler:
def useHandler(evt){
def data = evt.data
if (data && !data[0].startsWith("{")) {
data = decrypt(data)
}
def codeMap = parseJson(data ?: "{}").find{ it }
if (!codeMap) return
def codeNumber = codeMap?.key
def name = codeMap?.value?.name
def code = codeMap?.value?.code
log.info "slot:${codeNumber}, name:${name}, pin:${pinCode}"
}
1 Like
That looks good, Ill try it.
Thank you.