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.
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.
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?