I am using third party SIM cards in a bunch of Electrons, and am currently playing around with keepAlive times. I’ve noticed that many of the devices (though working perfectly) send a ‘device came online’ every couple of minutes or so.
What exactly triggers the ‘device came online’? It’s obviously not a restart…so I assume it’s if the device lost signal and came back online…but I’ve been logging Particle.connected
at 1 Hz, and it never goes offline…
Is it re-establishing itself with the Particle network and thus sends the signal? Would it go away if I shorted the keepAlive?
Are you actively sending or requesting data to/from the cloud in your code?
If not and your keepAlive is too long, the cloud connection might get lost without Particle.connected()
knowing about it.
A late keepAlive ping will fix that again.
If you have no info about the required keep alive interval, you should start with Particle.keepAlive(30)
and work your way up (maybe via binary search) till you start having issues like these reconnect events and then go back to an interval that doesn’t exhibit this.
Okay. That makes sense. I dropped it to 1 minute and it seems like it is fixed. Will it matter if I am sending data? i.e. If I go back to a longer keepAlive (say 2 minutes) but send data to the Particle backend at 1 minute intervals?
Has anyone tried putting together a spreadsheet of different SIM/Cell providers and the necessary keepAlive? I tried asking the company but they had no idea what I was talking about…?