Rebooting multiple devices OTA


#1

Is there a simple way to reboot multiple devices OTA without updating firmware? A few weeks all of my devices rolled their clocks back to 1970, and it seems a reset is necessary to get them back to the present.


#2

No, that’s not a built-in feature.

One useful alternative is to use a Particle.function that resets the device by calling System.reset(). It’s best to set a flag then actually do the reset from loop, otherwise the function call will appear to fail even though it succeeds because the device will reset before the acknowledgement is sent.

Of course you still need to do it one device at a time, but you can easily script this operation so you only need to issue one command to affect a change on many devices.


#3

To piggy back on @rickkas7 comment…
You can give all your devices a Particle.subscribe to a publish event when you want your entire fleet to see a global reset event.


#4

Besides the suggestions above, you can actually check for that condition and automatically trigger the time sync from within the devices firmware (usually works pretty well):

Somewhere in your loop():

if (!Time.isValid() || Time.year() <= 1970) {
    if (Particle.connected()) {
        Particle.syncTime();
    }
}

I personally also run my own makeshift time server with a lambda function accessed over MQTT (in case particle connection has issues, can still get time, which is critical for my application). You can then set time yourself using Time.set(...) if that might also apply to you.

Also just for your knowledge, time is synced on handshake with the Particle cloud, so the other approach you could take would be to create a “reconnect” cloud function (or subscription based event trigger) like the below. This publishes a special message that ends the connection, leading the device to automatically reconnect.

void reconnectParticle() {
     if (Particle.connected()) Particle.publish("spark/device/session/end", "", PRIVATE);
}