Passing function calls during SLEEP or Cellular.off

Ive searched the community.particle but nothing addresses this (which tells me there is, probably, an entirely different method to do what I want to do).

I am trying to find the best way to pass function calls to the electron while it is asleep or make it look for these function calls after it hits its “cellular.on” state? I am trying to save as much power as I can but need to be able to pass a date/time variable into the electron to store. Currently I can only pass these function calls when I know the electron is turned on and talking to the cloud.

If I put the electron to sleep for ten minutes and then wake for 1 minute and then back to sleep for 10 minutes, I dont want to wait until the one minute window to pass these variables.

Any suggestions? Much appreciated.

@reddevil, Particle.function() calls are not queued by the Particle Cloud. The best way to achieve what you want is to have the Electron do a Particle.publish() that a server/app subscribes to. The server then responds with a publish of its own to which the Electron subscribes. In that publish you would send the date/time data to the Electron to store. That way, the Electron is only awake to do the pub/sub transaction with the server.

Now, when you say date/time variable, you do know that the Electron has a real time clock and that it synchronizes it with every connection to the Cloud, right?

1 Like

Thanks @peekay123, Do you have any suggestions for the server/app to handle this? What would the sleep or cellular.off command look like in order to accomplish what you described. In other words how do I make it wake to sniff for a command?

I did know the Electron has a RTC, with my previous plan I knew it would sync the clock at every cloud connect. Under your suggestion i would just command it to sync once a day or so?

Thanks for your help.

To clarify @peekay123, I need to be able to pass a future date and time to the electron. The electron will store this value and then when that value date/time is reached a function on the electron will execute. I need to be able to pass these date/times multiple times a day if need be.

How were you planning to send this data? From an app, a web page, your own server, or something else? If you need to send these several times per day, then you need to wake your device fairly often to make sure you don’t miss one.

1 Like

@reddevil, to be a little more clear, short of using a 3rd party SIM and waking the Electron via SMS, it is the Electron which must initiate the request for data to a server via a pub/sub process. As @Ric pointed out, the Electron must wake at regular intervals to obtain data. The pub/sub approach is synchronous meaning the Electron requests data, the server responds with data, so nothing missed.

1 Like

I know of the suggestion with the external server, but nothing specific was suggested. :wink:

I would think a website like PubNub could do this.

I’d prefer to keep all of the subscribe and function calls in the Particle cloud if I could. Is there any chance this will be a Particle cloud feature in the future? Whether it be queued functions or some work-around for it. Hopefully it’s added as a feature request since there seem to be a couple posts on this specific topic. There is definitely interest out there. :slight_smile: