Console response to a particle.function call

I have an Electron fielded in a gate monitoring and auto closing, if left open, application. I recently added a particle.function to allow me to remotely close the gate using the Particle Console. Calling the function with Console does work, but it reports, in a red banner in the lower right, :Bummer! failed to call “close” (the name).
I have a: return 1; in the code and an else return -1:

I am running OS 0.8.0-RC.11 on the Electron

What does Console require as a successful acknowledgement?


David Garrison

The request is most likely timing out if you don’t return the function call quickly enough. What does your code look like?
Try setting a flag in the function and acting upon it in the loop.


Good one!

There is a two minute delay in the code before the return statement!. I need to power up the closing actuators for two minutes… there is a voice announcement that alerts folks near that gate that it will close automatically in 1 minute, 45 seconds , etc and then it announces closing stand back! . It then closes (slowly) and at the end of two minutes I remove the power (with a relay) and then issue the, return 1; statement

“Try setting a flag in the function and acting upon it in the loop.” --Great Idea I will try it.

Thanks for your help!

1 Like

Made the suggested changes and now the Console doesn’t complain anymore!
Is the request timeout referenced in any documentation somewhere?


David G.

Not sure if it’s documented somewhere, but in general any HTML request will time out if it takes too long.
You should consider treating a function call as an interrupt and keep any actions inside as short as possible.

Glad to hear you’re back up and running!

I have just added this to the docs.

This should go live soon