Force a product Update

Is there a way to force all devices which belong to a product to update immediately? As I understand it the devices will update on the next handshake. The handshake is usually on a reset.

We appreciate that this was probably done on purpose as you don’t just want your device to update and restart when it could be in the middle of something critical. But if the device holds a connection for a long period of time you have to wait an unknown length of time for an update.

As we see it the option currently is to have a device reset itself everyday at time x (and hence we know all firmware releases will be on all devices within a day) and we create a cloud command which we can invoke a reset on each device (for more critical updates).

We just want to check if there are any other clever designs/ solutions others have used before we do this

Not that I know of a “force-update” option, but instead of unconditionally resetting you could donate a Particle.function() or Particle.subscribe() to trigger a handshake.

But your request is a good incentive to reiterate on the use of System.updatesPending() and the related GitHub issue

1 Like

… yes how is this one still outstanding?

1 Like

There are other issues - similarly or even more important to limited user groups - open for even longer.
But due to limited HR a priority list has to be made and this kind of issue just hasn’t made it up the ladder yet.

  • we see some issues pop up in the forum (or other sources) more often than others
  • bug fixes are usually trumping enhancments
  • when there are viable workarounds, priority will be lower too
1 Like

Thanks for the suggestion but if we have an active connection to the cloud a function call by itself does not trigger a handshake. We would have to drop the connection in the function and reconnect.

Just tested a function call and the device’s last handshake time is not updated. And hence the firmware is not updated

That's what I meant with

I never meant the function call itself would, but the function/subscription handler can be written in a way to do.

1 Like

Ok great thanks. We will give it a go

I have tested this further. Creating a function which uses either:
Cellular.on() and Cellular.off() or
Cellular.disconnect() and Cellular.connect()

does not reliably create a handshake (even inserting a delay of 10s doesn’t seem to help). The connection comes back online without an update to the handshake details nor a release of the firmware.
The only reliable way to make this work seems to be to create a function which saves important info and then uses
System.reset()

As interest here is the test code I was using

#include "cellular_hal.h"//Needed to ensure the device stays on the cellular network after a reset
bool reconnect = false;
bool disconnect = false;

STARTUP(cellular_credentials_set("afrihost", "", "", NULL));// Becuase we are using a 3rd party sim we need to ensure the APN is set

void setup() {
  Particle.keepAlive(45);
  Particle.function("Test", Test);
}

void loop() {
  if (disconnect == true){
    //System.reset();
    Cellular.off();
    //Cellular.disconnect();
    disconnect = false;
    reconnect = true;
  }
  if (reconnect == true) {
    //Cellular.connect(cellular_credentials_set("afrihost", "", "", NULL));
    delay(10000);
    Cellular.on();
    reconnect = false;
  }
}
int Test (String Command) {
  //Cellular.disconnect();
  //reconnect = true;
  disconnect = true;
  return 1;
}

Nope, it doesn't.

I've written some "extensive" description what causes a handshake and how to leverage that into your code in some other thread - can't remember where tho'.
Maybe you can search for it.


Found the thread via "@ScruffR handshake workaround"

1 Like

Thanks for the link. Clearly not the first person to have this issue. We will look at it more closely