I have a Particle Photon connected to a BME280 sensor as a weather station updating to the Blynk app on my roof.
Lately this weather station just randomly dies - sometimes I can get it to last up to 2 days, but it usually only lasts a couple of minutes after each reset.
I’ll go to unplug the power, plug it back in, doesn’t matter if I wait 5 seconds or 5 hours, it will work, connect to the wifi, update the temperature, and eventually, just die, and turn off. The console will report the photon as off and unpowered/disconnected.
However, the console is telling me that the Photon is sending a “spark/status” event labelled “offline” - does this mean the Photon is not crashing but actually “saying goodbye” and shutting down intentionally?
That’s an image of the console logs when I last rebooted the weather station - you can see it was able to give one temperature and humidity update before shutting down again 2 minutes later.
And what does “spark/device/last_reset” showing “power_down” mean, does this refer to why the unit turned off the last time? Does it offer any insight?
Despite this happening, the console also shows “0 disconnect events” - I guess that only means wifi and not the entire unit?
My best guess is that my BME280 sensor is failing, and eventually when the Photon tries to read it, it gets some kind of garbage data, gets confused, and crashes with one of those flashing red LED errors. Would such a crash show up in the event log?
Is there any way to change my code to anticipate this error and ignore it, without knowing exactly what the error is? It’s not very long or complex code: