Trouble waking photon from SLEEP_MODE_DEEP, running functions then back to sleep

Hi All,

I’m super excited for my new photon. My first project is battery powered so obviously power consumption is huge.

I’m trying to make my photon wake up from a deep sleep - see if there have been any functions POSTED on the cloud - execute those functions - then return to sleep with a 10 second timer.

I assumed that if I had a SPARK.PROCESS() before requesting deep sleep, it would run any function called before moving onto the next line of code.

FYI, I’m calling my functions via IFTTT and the Do Button app.

Any tips?


Sorry, i should have mentioned that what happens is my Photon ends up in a deep sleep loop and I need to boot into safe mode to try again.

I’m not completely sure if I understood your problem right, but at the moment there is no support for defered function calls.
If your Photon is offline at the moment when the function is called, the call will just timeout and report back unsuccessful.

Defered execution is on the ToDos tho’
I guess most likely with Particle.publish()/subscribe() rather than Particle.function().

But there might be a possible workaround by setting up a webhook that listens for a Particle.publish() that’s sent by your waking Photon.
If you queue your function calls somewhere in the net, the queued function calls could be triggered.

Thanks for the info.

I did have some success of sending a function call, then the Photon correctly executed the commands after being powered up shortly after. Maybe the IFTTT platform tried multiple times before timing out. I am not sure.

Either way, thanks for your advice. I’ll try implementing a web function that listens for a particle.publish to know when the Photon is connected.

1 Like