I activate the force-updates options in the console and get this.
But then, when my device restarts, I get this event and force-updates goes back to disabled automatically.
I also get the event telling that I have updates activated for the device, but nonetheless it never auto-updates unless I do a power reset. This is certainly not suitable for remote updating.
For more information, I also activated explicitly updates (System.enableUpdates();) and ask for updates pending with System.updatesPending(); and wait 5 seconds connected to the cloud to give it time to send the update.
Thanks in advance, I really hope there’s a solution for this.
Force updates is only intended to be used if you call System.disableUpdates() in your user firmware and unintentionally put yourself in a situation where you can’t flash code to your device because you no longer have a way to enable it again. Since it’s only intended to be used for emergencies to ignore System.disableUpdates(), it turns off automatically after an update.
I think what you are looking for is intelligent firmware updates, which can update all devices or device groups immediately if they are online. That feature is only available to enterprise accounts.
Regular products will only get their firmware updates when the device comes online.
The thing is my device goes to sleep and wakes up periodically to send new data and then go back to sleep. When it wakes up, I would want my device to check if there is a new firmware update and update if necessary. Is there any way to secure firmware updates when available with regular products? if not, what can I do in order to access the correct features?
If you are using stop mode sleep (pin, time, or pin+time) with SLEEP_NETWORK_STANDBY a reconnect to cloud does not automatically occur because you essentially stay connected all the time. You’d have to force reconnection periodically to get an update in this case. For example, you could call System.reset() once a day to get an update.
If you’re using any other sleep mode you should be getting the update, as long as you stay awake long enough. Staying awake for 10 seconds should be sufficient. However, if you are using SYSTEM_THREAD(ENABLED) you also should monitor the firmware update events to make sure that an update is not currently in progress before sleeping.
I am actually using (SLEEP_MODE_DEEP, 'time'), and I disconnect from particle and turn off cellular before sleeping. I will try forcing ten seconds of connection, right now I’m connected for around 6 seconds.
UPDATE: I tried keeping it connected for ~11 seconds after before publishing an event. It woke up to send data every 20 minutes for 14 hours and never updated. The console even shows a handshake but did not update.
I am currently not using SYSTEM.THREAD(ENABLED), I'm using MANUAL mode though. I actually want my code to stop if I get an update, but I can try this alternative. How can I monitor system update events? Should I subscribe to them and turn on a flag? Can this make a difference?