Smartthings Timed Out when running a function?

I get this error Read timed out

When running a function that takes more than 10 seconds.
What is the best way to resolve this issue?

This is a part of a device type where a call asks a Particle Photon to run a function that has a delay in it.

You need to call asynchronously.

Ok. So I tried that and I get a 400 Error (Failed with status code 400).

Here is my code:

private sendToDevice(cmd) {
    def params = [
        uri: "",
        path: "/v1/devices/${deviceId}/${query}",
        body: [access_token: token, command: "${cmd}${duration}"]
    ]'processResponse', params)
def processResponse(response, data) {log.debug (}

Here is what I had originally:

private sendToDevice(cmd) {
		uri: "${deviceId}/${query}",
		body: [access_token: token, command: "${cmd}${duration}"],  
	) {response -> log.debug (}

Error 400 generally indicates a mis-formatted request.

Unfortunately, I don’t know enough about the the quirks of the AsyncHttp API to debug it.

I suggest trying a super simple case against a web server that you can use to view and debug the incoming request, and incrementally iterate until it works.

You can also search the forum for example uses of “asynchttp”.

I figured it out. Thank you very much for the suggestion. Your solution worked!

1 Like