I need to be able to set and id for all my devices and change them from the cloud. If I just use a variable and then update it from the cloud using particle.function() then this value would be reset to its default on a power cycle instead of the last set value I believe. therefore i need something that will write the value change even between power cycles
You can store the ID in EEPROM or a file on the flash file system.
The other option is to use Ledger and a per-device cloud-to-device ledger. This might be overkill for your use case, but is a better choice if you have not just a single ID, but other settings as well that you want to synchronize to the device. The device keeps a copy of the ledger locally in the flash file system automatically and only updates it when it changes. The other advantage is that you can associate your ID and the Device ID in the cloud in advance, and the first time the device comes online it will get the updated ledger data.
5 Likes