Ok… I have made some changes to the code because I determined that the SmartApp is not sending data in the proper format.
// Send events to external HTTP\HTTPS url
private logEvent(evt, Closure c) {
def evtJson = new groovy.json.JsonOutput().toJson([
deviceId: evt.deviceId,
evtName: evt.displayName,
evtValue: evt.value,
evtType: evt.name,
evtUnit: evt.unit,
evtIsStateChanged: evt.isStateChange,
evtSource: evt.source,
evtDescription: evt.description,
date: evt.isoDate
])
if (state.enableEvtServer == true) {
log.debug "Attempting to POST Data to ${state.evtServerAddr}"
httpPost(uri: "${state.evtServerAddr}", body: [evtJson]) { resp ->
resp.headers.each {
log.debug "${it.name} : ${it.value}"
}
log.debug "response contentType: ${resp.contentType}"
}
if(resp.data == 0) {
log.debug evt.name+" Event has been successfully posted to ${state.evtServerAddr}"
log.debug "\'$evt.name\' event received from: $evt.displayName, isStateChanged: $evt.isStateChange, Value: $evt.value, Unit: $evt.unit, Source: $evt.source, Description: $evt.description, Device Id: $evt.deviceId"
}
}
if (state.enableEvtServer == false) {
log.debug "\'$evt.name\' event received from: $evt.displayName, isStateChanged: $evt.isStateChange, Value: $evt.value, Unit: $evt.unit, Source: $evt.source, Description: $evt.description, Device Id: $evt.deviceId"
}
}
Here is what is returned in the event log:
error groovy.lang.MissingMethodException: No signature of method: groovyx.net.http.EncoderRegistry.encodeForm() is applicable for argument types: (java.util.ArrayList, groovyx.net.http.ContentType) values: [[{"deviceId":"090f4f7c-0682-4020-b00a-a1cf794ea149","evtName":"Multisensor - Playroom","evtValue":"active","evtType":"motion","evtUnit":null,"evtIsStateChanged":"true","evtSource":"DEVICE","evtDescription":"zw device: 4C, command: 9881, payload: 00 30 03 FF","date":"2015-08-19T22:19:18.475Z"}], ...]
Possible solutions: encodeForm(java.lang.String, java.lang.Object), encodeForm(java.util.Map), encodeForm(java.util.Map, java.lang.Object), encodeAsJs(), encodeAsURL(), encodeAsRaw() @ line 334