bdwilson / ThingSpeak-Energy-Logger

SmartThings SmartApp Energy Logger for ThingSpeak
4 stars 11 forks source link

UndeclaredThrowableException/MalformedChunkCodingException #1

Open hogpowerenergy opened 7 years ago

hogpowerenergy commented 7 years ago

I am getting some errors running this code:

private updateChannelInfo() { log.debug "Retrieving channel info for ${channelId}"

def url = "http://api.thingspeak.com/channels/${channelId}/feed.json?key=${channelKey}&results=0"
httpGet(url) {
    response ->
    if (response.status != 200 ) {
        log.debug "ThingSpeak data retrieval failed, status = ${response.status}"
    } else {
        state.channelInfo = response.data?.channel
    }
}

state.fieldMap = getFieldMap(state.channelInfo)

}

When it gets to httpGet(url) I get the following errors:

java.lang.reflect.UndeclaredThrowableException @ line 82 9682238b-0a4c-4135-846a-cbd8cb02c369 11:09:02 AM: error org.apache.http.MalformedChunkCodingException: CRLF expected at end of chunk @ line 82 9682238b-0a4c-4135-846a-cbd8cb02c369 11:09:02 AM: debug Retrieving channel info for xxxxxx

Any suggestions?

dennisworld2 commented 7 years ago

See changes in my PR https://github.com/bdwilson/ThingSpeak-Energy-Logger/pull/2 ... they should fix the issue.