Pulling a value from the cloud

I am setting up a system that periodically collects some sensor data, publishes it, then goes to sleep. I have a particle.function call that enables users to adjust some parameters remotely. My problem is that the device is asleep for most of the time, so the call to the particle.function has to be carefully timed. What I’d really like to do is get my device to pull a value from the cloud each time it wakes up. I can’t get my head around how to do this.

If it makes any difference, I’m currently experimenting with using the Google Cloud integration to manage the cloud side of things.

Any pointers would be gratefully received!


You can the Particle.function() route but what you need is a “I have woken up and I am listening for a command” pub-sub relationship between your server and the devices. This then has to have a timeout and can be missed, etc.

Alternatively, as you have identified you can pull the parameters using GET with HTTP. The reference documents https://docs.particle.io/reference/device-cloud/webhooks/#webhook-properties
should help you get something working and searching on the forum topics!

If you are using an Electron, it has a neat feature ( WakeOn RI ) so that a function call from the Cloud would wake it from sleep.......worth mentioning just in case this matches your application.

What about using a webhook or publish when the device has data ready that triggers the funtion call? Or, using a publish with a data collection device that subscribes to those publishes and has the data available on call?