How to put the Tracker one to sleep immediately? and what is the right way to handle wakeup properly?

Is there a way to put the tracker one to sleep immediately?

This is what I am doing right now and is this the right way to command the tracker one to sleep as early as possible?

TrackerSleep::instance().resumeSleep();
TrackerSleep::instance().extendExecutionFromNow(1, true);

https://docs.particle.io/reference/asset-tracking/tracker-edge-firmware/#trackersleep

I works at times, but there are times it takes some time before it goes to sleep

my second question is what is the best way to handle the wakeup?

This is my code on the wakup callback

TrackerSleep::instance().extendExecutionFromNow(180, true);
TrackerSleep::instance().pauseSleep(); // dont sleep. we will call the function above for the device to sleep

// need to be fully awake and connected to the internet asap
if (!TrackerSleep::instance().isFullWakeCycle()) {
    TrackerSleep::instance().forceFullWakeCycle();
  }

Are these the right way of handling the sleep and wakeup?

Thanks!

The sleep settings are also configured in the cloud settings in the console. The most important setting for your purposes is post publish execution time, which you probably want to set to 1 instead of the default 10.

You should not use extend execution from now because that will only make the sleep period longer, not shorter, than the post-publish execution time.
Also pauseSleep() will override the timed execution sleep, so you usually don’t need both on wake.

Is there a reason you’re forcing a full wake cycle? This will override maximum location update frequency. This can cause excessive data and power consumption, and also cause your SIM to be banned from the cellular network for aggressive reconnection if you have additional wake sources.

Hi @rickkas7, Do you have more details on how many connections to the cloud would get our tracker banned from the network for aggressive reconnection?

I saw It is possible for your mobile carrier to ban your SIM for aggressive reconnection if it does a full reconnection more often than every 10 minutes. in the documentation and just want to see how strict this is.

There is no set number. It varies by carrier and, apparently, their mood. The 10 minute limit is the upper bound of what is considered safe. Anything less than that is in the danger zone.

Doing more frequent connections than that during development will probably be fine. Putting a fleet of dozens of devices in a small area connecting once a minute will probably raise the ire of your carrier and get your SIMs banned.

If you need to connect very frequently you may need to adjust your power budget and use cellular standby mode. Since the PDP session stays up, the carriers do not consider it a disconnection, even if the Tracker is asleep. That's essentially what your cell phone does.

1 Like

Thank you @rickkas7!