Yes, this is what I am doing. I have a SmartApp that responds to events and sends the data to a web service (actually just a web handler).
/**
*/
definition(
name: âData Publisherâ,
namespace: ââ,
author: âJeff Mayâ,
description: âPushes data to the Serverâ,
category: âMy Appsâ,
iconUrl: âhttps://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.pngâ,
iconX2Url: âhttps://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.pngâ,
iconX3Url: âhttps://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.pngâ)
preferences {
section(âDoor Sensorsâ) {
input âlabDoorâ, âcapability.contactSensorâ, title:"Where ?"
input âserverDoorâ, âcapability.contactSensorâ, title:âWhere ?â
}
section(âSwitchesâ) {
input âlabLampâ, âcapability.switchâ, title:âWhere ?â
}
section(âMoistureâ) {
input âshower1â, âcapability.waterSensorâ, title:âWhere ?â
}
section(âMotion & Presenceâ) {
input âjeffOfficeMotionâ, âcapability.motionSensorâ, title:"Where ?"
input âpresenceTagâ, âcapability.presenceSensorâ, title:"Where ?"
input âoutsideTempâ, âcapability.temperatureMeasurementâ, title:âWhere ?â
}
section(âPower Outletsâ) {
input âJeffOfficePowerâ, âcapability.powerMeterâ, title:âWhere ?â
}
}
def installed() {
log.debug âInstalled with settings: ${settings}â
initialize()
}
def updated() {
log.debug âUpdated with settings: ${settings}â
unsubscribe()
initialize()
}
def initialize() {
subscribe(labDoor,âcontactâ,dataChangeHandler)
subscribe(serverDoor,âcontactâ,dataChangeHandler)
subscribe(labLamp,âswitchâ,dataChangeHandler)
subscribe(Shower1,âwaterâ,dataChangeHandler)
subscribe(jeffOfficeMotion,âmotionâ,dataChangeHandler)
subscribe(presenceTag,âpresenceâ,dataChangeHandler)
subscribe(outsideTemp,âtemperatureâ,dataChangeHandler)
subscribe(JeffOfficePower,âpowerâ,dataChangeHandler)
}
def dataChangeHandler(evt){
log.debug â$location: $evt.date - $evt.id : $evt.displayName - $evt.stringValueâ
def params = [
uri: "http://www.dummy.org",
path: "/handlers/SmartThingsHandler.ashx",
query:[sensor:evt.displayName,value:evt.stringValue,area:location]
]
try {
httpGet(params) { resp ->
if (resp.data) {
log.debug "Response Status = ${resp.status}"
log.debug "Response Data = ${resp.data}"
//resp.headers.each {
//log.debug "header: ${it.name}: ${it.value}"
//}
}
//if(resp.status == 200) {
// log.debug "Request was OK"
//}
//else {
// log.error "Request got http status ${resp.status}"
//}
}
} catch(e)
{
log.debug e
}
}