# Reconnecting Electron after a paused SIM - Deep Sleep and Sleep Network Standby

**URL:** <https://community.particle.io/t/reconnecting-electron-after-a-paused-sim-deep-sleep-and-sleep-network-standby/48351>\
**Category:** Cloud\
**Tags:** electron\
**Created:** [March 11, 2019, 6:56am UTC](https://community.particle.io/t/reconnecting-electron-after-a-paused-sim-deep-sleep-and-sleep-network-standby/48351 "2019-03-11T06:56:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimbol](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jimbol](https://community.particle.io/u/jimbol)\
**Post date:** [March 11, 2019, 6:56am UTC](https://community.particle.io/t/reconnecting-electron-after-a-paused-sim-deep-sleep-and-sleep-network-standby/48351/1 "2019-03-11T06:56:42Z")

</div>

Hi All,

I had a problem recently with a pause/unpause cycle on an Electron, which couldn’t be resolved without manual intervention at a very remote site. I’ve reworked my code so that it will reconnect after a paused SIM. And I thought I’d share what I found, as I didn’t find this info anywhere else.

A remote electron used more data than usual in February, and went over it’s data limit. I’m still not sure why it’s data usage was high. The SIM was paused, and shortly after I unpaused it and increased it’s data cap so that it could go about it’s business. It never did reconnect until I got out to it 10 days later and put it into Safe Mode. It took approximately 5 minutes to reconnect, which surprised me.

So I did some testing, and found that if the electron had gone to sleep using SLEEP\_MODE\_DEEP and SLEEP\_NETWORK\_STANDBY, it took between 325 and 340 seconds to wake and reconnect the first time after a SIM unpause. (It only took 1-3 seconds in this condition to connect if the SIM was already active).

If the electron was in SLEEP\_MODE\_DEEP, it would reconnect after the SIM unpause after about 16-18 seconds.

So I have now added a different sleep statement if my electron times out before Particle.connected that will put the electron in SLEEP\_MODE\_DEEP (without SLEEP\_NETWORK\_STANDBY), which will better tolerate reconnection after unpausing SIM card.

I have been using SLEEP\_NETWORK\_STANDBY and a 20 minute publish cycle to keep my cellular data use low, and my code initially waits up to 120 seconds for Particle.connect, and goes to sleep if it doesn’t connect. This is to prevent depleting the battery in case of a network outage like we had earlier this year that knocked out a number of electrons.

Since I used the same sleep statement for any time my electron would sleep, it always went to sleep with SLEEP\_NETWORK\_STANDBY, and therefore wouldn’t connect.

I didn’t expect that there was any mode that would take that long to reconnect, or that there would be such a drastic increase in connection time between SLEEP\_MODE\_DEEP with and without SLEEP\_NETWORK\_STANDBY.

---

<div class="post-metadata">

**Author:** ![KyleG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/kyleg/32/11077_2.png) [@KyleG](https://community.particle.io/u/KyleG)\
**Post date:** [March 13, 2019, 9:39pm UTC](https://community.particle.io/t/reconnecting-electron-after-a-paused-sim-deep-sleep-and-sleep-network-standby/48351/2 "2019-03-13T21:39:14Z")

</div>

@ParticleD, or @mstanley are you able to assist?

---

<div class="post-metadata">

**Author:** ![jimbol](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jimbol](https://community.particle.io/u/jimbol)\
**Post date:** [March 13, 2019, 11:58pm UTC](https://community.particle.io/t/reconnecting-electron-after-a-paused-sim-deep-sleep-and-sleep-network-standby/48351/3 "2019-03-13T23:58:53Z")

</div>

I don’t really need any assistance with this currently, I just wanted to put it out there that there is a long delay to reconnect after a Sim pause if you use sleep network standby. It broke my connectivity because I didn’t know there was this consequence of using that mode.

I think it would be good to have someone else confirm this and have it documented somewhere so it doesn’t catch others unaware.  
J

---

<div class="post-metadata">

**Author:** ![mstanley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mstanley/32/20170_2.png) [@mstanley](https://community.particle.io/u/mstanley)\
**Post date:** [March 14, 2019, 6:41pm UTC](https://community.particle.io/t/reconnecting-electron-after-a-paused-sim-deep-sleep-and-sleep-network-standby/48351/4 "2019-03-14T18:41:40Z")

</div>

Sounds like that would be a good thing to run by @rickkas7 then Rick does documentation for Particle.
