I just (painlessly) move my Schlage BE469 from ST to Hubitat. So far so good. I seem to be getting better response times in Hubitat. Only problem I have is getting code/name information when someone unlocks the door with the keypad. In ST, I had modified the DH for this lock to "sendEvent(customEventName,eventData" when someone used the keypad with a code. A groovy app would "subscribe(customEventName,codeandNameHandler). I can not figure out how I can do this in Hubitat.
I know I can get evt.descriptiveText as well as evt.data but I would like to be able to construct my own message which would include the name as well as the code used. The evt.data ({"1":{"name":"Cor and Kathy","code":"5875"}}) contains all the info I need but I cant for the likes of me figure out how to parse it into name and code values.
That works really well once I figured out I was using the wrong DH for my Pushover devices. Basically, thats al I need, however......
Anyone want to create their own customize groovy app, start with this
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
def subscribeToEvents() {
subscribe(myLock, "lock", eventHandler)
}
def eventHandler(evt) {
if (evt.data) { // Door was opened with code
def codeData = new JsonSlurper().parseText(evt.data)
log.info codeData
def theName = codeData["1"]["name"]
def theCode = codeData["1"]["code"]
pushoverDevice.deviceNotification("$evt.displayName was opened by $theName using code $theCode")
}
else { // Door was opened manually
pushoverDevice.deviceNotification(evt.descriptionText)
}
}