@bflorian
Hi Bob,
Ok… one step forward.
I have a very simple http server here. When I input this url to the browser:
http://10.0.0.12:8080/?ampOFF
I get back:
ampOFF command received.
If I then test using the following SmartApp in the sim:
preferences {
section("When the following is turned on and off...") {
input name: "master", title: "Which Switch?", type: "capability.switch", required: true
}
}
def installed() {
subscribeToEvents()
}
def updated() {
unsubscribe()
subscribeToEvents()
}
def subscribeToEvents() {
subscribe(master, "switch.on", onHandler, [filterEvents: false])
subscribe(location, null, lanResponseHandler, [filterEvents:false])
}
def onHandler(evt) {
doHAMB()
}
def lanResponseHandler(evt) {
log.debug "In response handler"
log.debug "I got back ${evt.description}"
}
def doHAMB() {
def ip = "10.0.0.12:8080"
sendHubCommand(new physicalgraph.device.HubAction("""GET /?ampOFF HTTP/1.1\r\nHOST: $ip\r\n\r\n""", physicalgraph.device.Protocol.LAN))
}
I get back:
2:39:18 PM: debug I got back index:01, mac:0016CBA27305, ip:0A00000C, port:1F90, headers:SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LVR5cGU6IHRleHQvaHRtbA0KQ29udGVudC1MZW5ndGg6IDI0, body:YW1wT0ZGIGNvbW1hbmQgcmVjZWl2ZWQu
2:39:18 PM: debug In response handler
Which makes perfect sense as the string after ‘body:’ decoded from base64 = ‘ampOFF command received.’
So now if I input the following from the browser:
http://10.0.0.31/query/info
I get back:
{"name":"Upstairs","mode":0,"state":0,"fan":0,"fanstate":0,"tempunits":0,"schedule":0,"schedulepart":255,"away":0,"spacetemp":62.0,"heattemp":69.0,"cooltemp":85.0,"cooltempmin":35.0,"cooltempmax":99.0,"heattempmin":35.00,"heattempmax":99.0,"setpointdelta":4.0,"availablemodes":1}
But when using the above test app with the follwoing changes:
def ip = "10.0.0.31:80"
sendHubCommand(new physicalgraph.device.HubAction("""GET /query/info HTTP/1.1\r\nHOST: $ip\r\n\r\n""", physicalgraph.device.Protocol.LAN))
I get back nothing. It is as if the ‘lanResponseHandler’ is never called.
I am afraid I still don’t understand why.