Hello, I have implemented a smartapp that writes events to elasticsearch.
Below is the snippet of the groovy code written on SmartThings IDE. I tested the curl command separately outside the SmartThings IDE, and it worked just fine. I also double checked that the sensors are continuing to produce events and my hub is capturing them correctly. However, the smartapp I implemented doesn’t seem to execute the curl command correctly. I don’t see any log messages either, so it is difficult to debug.
So, why am I not seeing anything on the log window? Does the curl command execution part contain any syntax error?
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
subscribe (motion1, "motion", motionHandler)
subscribe (temperature1, "temperature", temperatureHandler)
subscribe (accel1, "acceleration", accelHandler)
}
// TODO: implement event handlers
def motionHandler() {
// send evt.value to big data analyzer
log.debug "Motion: ${evt.value}"
def response = ["curl", "POST", "http://some-address:9200/smartthings/motion", "-d", "{state:\"${evt.value}\"}"].execute().text
}