Here’s my code: https://go.particle.io/shared_apps/5aa9803de93dfff9f0001a2a
Often what I find, is that when I run this code (doesn’t matter if Automatic, or Semi-Automatic) the Electron apparantly has a tough time properly connecting to the Particle Cloud.
For instance, I run the code, the Electron blinks green and then continues to rapidly blink cyan as it goes through the code. It sometimes finds the correct cell tower information (sometimes blanks) but the deviceLocator event never is published into the Console.
When it does work, it works well, but perhaps only in about 25% of my device bootups am I actually consistently receiving the webhook responses on my Console. The times it works, the Electron in fact breathes cyan, which makes me believe this is a Cloud connection issue.
Can anyone spot an issue with this code? Other than this, my devices never have an issue connecting to the Particle Cloud, it’s only with this particular code.
I can’t see you setting
Particle.keepAlive() in your code but I suppose your 3rd party cell provider does not have 23 minutes keep alive.
This might contribute to lost cloud contact which in turn may cause some of the publishes to “dead-fire” just to reestablish the connection but not actually making it to the cloud.
Yes, I just realized that very obvious mistake
However, even after adjusting it the issue persists. Although Particle.connected() returns true (tested with this), the Electron sits there blinking cyan, outputting cell tower information but not actually sending anything to the Particle Cloud.
Have you got an updated snapshot of your project?
Does the device behave normal when in Safe Mode?
You can add
SerialLogHandler traceLog(LOG_LEVEL_ALL); to enable system log output and see whether this reveales something.
It outputs a whole lot of stuff, too much to post here and too complex for me to understand myself.
However, I think it’s actually going to work for me. I only need a lat/lng fix once every few days. As long as the power source isn’t removed, it seems that once it does work, it continues to work fairly reliably.