Particle.function when electron wakes

Hey all!

I’m looking for a bit of advice about using the particle.function command.

So I have an electron that sleeps and wakes every 15 min for 1 min then goes back to sleep. Obviously I can’t connect to the electron while it’s in sleep mode but when it wakes I would like it to check if there has been a request while it was asleep.

Anybody have any ideas on how to do this?

Do you mean, you want to know if there was an attempt to call a Particle function while the device was asleep? There’s no way to do that from the Electron side. When it’s asleep it doesn’t have any way to know if a function has been called, or a variable polled, since it’s offline.

@PeaTearDial, to add to what @Ric said, the Particle Cloud does not queue any events or Particle.function() calls.

Thanks all,
Would there be an alternative way for me to do this?
I basically want to be able to get the particle to wake up and check to see if a variable has changed since it was last awake…

A variable can’t change when the device is asleep, since code has to be running for that to happen. Maybe you can tell us in more detail what you’re trying to do. What variable are you wanting to look at? How does it change?

Hey sorry I haven’t been clear enough.

Ok so my electron sleeps most of the time.
It wakes up every 15min to do a particle.publish then goes back to sleep.

I would like to be able to remotely change how often the electron wakes up.
So it wakes up, checks a variable somewhere online to see if anything has changed … maybe the variable has changed from 15 to 5 for example. The electron would go back to sleep but wake up every 5 min from now on.

To a certain extent, how you do this depends on what “somewhere online” means. If you have a phone app or web app, it can subscribe to an event that your Electron publishes when it wakes up. In response, the app can either call a function on the Electron (which would change the value of some variable), or publish an event that the Electron subscribes to.