Access attributes other than value on evt

I’m new to SmartThings and SmartApps; however, I’ve modified a device driver to output more useful information and I want to access that inside my SmartApp. Here’s an example of the output from the Live Log. I added the following part:

'isManual':true, 'isKeypad':false, 'isCommand':false, 'isAutoLock':false,

Here’s the output of the live log:

zw device: 05, command: 9881, payload: 00 71 05 15 01 " parsed to ['name':'lock', 'value':'locked', 'isManual':true, 'isKeypad':false, 'isCommand':false, 'isAutoLock':false, 'isStateChange':true, 'displayed':true, 'linkText':'Front Door', 'descriptionText':Front Door lock is locked]

Here’s a snippet of my SmartApp:

def initialize() { subscribe(lock1, "lock", doorHandler) } def doorHandler(evt) { log.debug evt.isManual }

This is the error I get:

groovy.lang.MissingPropertyException: No such property: isManual for class: physicalgraph.event.cassandra.Event

Okay, so I read the documentation on events and it seems that I can’t create these custom attributes and access them, there are only some preset attributes that can be used. So, is there another way to pass the information back from the Device Type to the SmartApp?

If you aren’t creating your own attributes and then creating events for those, you can send info along with the event using the data option:

sendEvent(name: 'someEvent', value: 'someValue', data: [isManual: true, someOtherKey: "someOtherVal"])

Then in your event handler, access it like this:

log.debug "isManual: ${}"


That should work awesomely. I ended up using evt.description, breaking that out into map, and then keying off the payload.

def parseDescriptionAsMap(description) {
    (description - "read attr - ").split(",").inject([:]) { map, param ->
        def nameAndValue = param.split(":")
        map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]

def eventLookup(payload) {
    def map = [
        '00 71 05 12 00' : 'lockKeypad',
        '00 71 05 13 01' : 'unlockKeypad',
        '00 71 05 15 01' : 'lockManual',
        '00 71 05 16 01' : 'unlockManual',
        '00 71 05 18 01' : 'lockCommand',
        '00 71 05 19 01' : 'unlockCommand'
    return map[payload]

def doorHandler(evt) {
    def payload = parseDescriptionAsMap(evt.description).payload
    def eventType = eventLookup(payload)

I’ll use the data attribute though, as that allows me more flexibility.

When i try to access, it says isManual property doesn’t exist. When log just, I see the keys have quotes around them, is that causing a problem, I didn’t put quotes around them inside the device type.

#Output of SmartApp {“isManual”:true,“isKeypad”:false,“isCommand”:false,“isAutoLock”:false}

[ name: “lock”, value: “locked”, data:[ isManual: false, isKeypad: false, isCommand: true, isAutoLock: false ] ]

The quotes shouldn’t matter… but you could try indexing into the map like data["ismanual"].

I can try and look/reproduce more tomorrow.

Here’s how I made it work.

def evtData = new JsonSlurper().parseText(
log.debug evtData.isManual

It looks like the data isn’t being de-serialized out of its json format for some reason.

Try using parseJson() and see if that works:

def myData = parseJson(
log.debug "isManual? ${myData.isManual}"

Is parseJson() just a shorthand function for JsonSlurper().parseText()