So I’m following this guide: https://developer.electricimp.com/api/imp/setenroltokens on how to enrol my devices at the factory.
I’m a little unclear about the last step.
if (success) {
imp.setenroltokens(tokens.plan_id, tokens.id);
// Don't do imp.clearconfiguration() here - we still want valid WiFi credentials to complete the enrol
// After one second, production code will be downloaded and run
}
I waited about 10-20 seconds after seeing the green light appear on my board saying it was blessed successfully. However in ImpCentral the device was still showing unenrolled. It wasn’t until I power cycled the device did ImpCentral report that it had been enrolled but with the timestamp of when I power cycled it and not before during the factory blessing process.
So my question is does enrolment actually happen during the blessing process? Or are the tokens just saved and then down the road when it does connect will it enrol then. If that’s the case how long are the enrolment tokens valid for? If it sits in a warehouse for months before being used will they still be valid when it comes online for the first time and tries to enrol.
Finally instead of calling imp.clearconfiguration();
can I actually call imp.setwificonfiguration();
and set a different WiFi network instead of the one in the factory used for blessing? Or will it not download the production code onto the device if I set a WiFi configuration which isn’t available in the factory?
Just trying to clarify exactly what happens post blessing.
Thanks