I know I can ask the Hub to invoke a HTTP request using the following code in a SmartApp:
sendHubCommand(new physicalgraph.device.HubAction("""GET ${path} HTTP/1.1\r\nHOST: $host\r\n\r\n""", physicalgraph.device.Protocol.LAN, host, [callback: myHandler]))
This will invoke the myHandler method on the SmartApp.
I wanted to do the same thing in a Device Handler, for instance I make a GET request to an endpoint, after maybe 3 seconds the request is complete, so I want to remove the Opening state and set the Open state.
I know I can get the response to HubActions through the parse handler, but this is called for every event. If the user mashes the Open/Close button I do not know in which order the responses are for, and I have to save state about what was happening for this particular request.
I really would like access to the closure as exposed to SmartApps through the httpGet method, which as far as I am aware is not supported in Device Handlers.
I would appreciate any help.