Logging from with in parse(), is it working for anyone?


(sidjohn1) #1

I submitted a ticket of this already, but wanted to through it out to the community as well to be sure it’s not a PEBKAC/ID10T issue. My thinking cleaner devicetype uses parse() to parse a JSON response file called by hubaction. I use the parsed JSON response to update the devices tiles and i know all of that works because all the tiles response the way i expect them to.
I’m working on updating the devicetype for some newly released API features to reduce polling and add bin full notifications. I’m using log.debug result.action to see how the JSON output is being handled but i don’t see the response in live logging. I even tried a very simple log.debug “test” and i still get no response in live logging. Logging in other functions seam to work just fine… just not logging in parse(). Is anyone else seeing the same thing or am i just missing something simple?


(John S) #2

Smart Sense Multi (the device type for multi sensor) has

def parse(String description) {
    def results

    if (!isSupportedDescription(description) || zigbee.isZoneType19(description)) {
        results = parseSingleMessage(description)
    }
    else if (description == 'updated') {
        //TODO is there a better way to handle this like the other device types?
        results = parseOtherMessage(description)
    }
    else {
        results = parseMultiSensorMessage(description)
    }
    log.debug "Parse returned $results.descriptionText"
    return results

}

And when I live log opening or closing one I see:

249f0f75-be32-4eff-b612-2801f4f4823e 10:28:12 AM: debug	Parse returned Inner Door was opened

So, looks like its working to me.


(Patrick Stuart [@pstuart]) #3

Are you logging a devicetype that uses a SmartApp and trying to log the devicetype parent actions?

If so, this doesn’t work. Best is to return “status” in the calls from the devicetype and log the response in the devicetype there.


(sidjohn1) #4

No, just a very simple device, logging output to live logging… No app involved at this point.


(sidjohn1) #5

Thx for checking… that come sniper reminds me i’ve be wanting to make a code change to define my variables before i use them in a function… and i have had that fix some weird stuff.


(sidjohn1) #6

This is weird, i just gave it another shot and it works… no changes on my side… I know a platform update got pushed today, i’m hoping that is what fixed it.