Setup finished with result successNotClaimed returns nil device

When finishing the setup of the photon device, the set up controller returns a nil ParticleDevice. Is it needed to claim it or to be logged into Particle to get the device info? We want to get the DeviceID

1 Like

You can get the Device ID by either

  1. connecting a serial terminal app to it, putting it into Listening (blinking blue) mode, and then entering “i” (for “information”), or

  2. Installing the Particle CLI, putting the device into Listening mode, and entering particle identifyat a command prompt.

Then, you can claim it either from the Web IDE’s device page or by entering the CLI command particle device add <device ID>. The device must be online (breathing cyan) for claiming to work.

But when particle set up is finished in set up only mode it returns an empty device so I can’t get the ParticleID of the device. There is the same error for Android and an issue has been opened: https://github.com/particle-iot/particle-android/issues/97

What was the output when you did 1. and/or 2. of @ParticleD’s suggestions?

I would have to investigate the code, but this behavior makes sense and I don’t think this is an error. Device ID is sensitive information and should only be available to owner of the device. Setup only should only be used to configure wifi creds and nothing else.

Hi @Raimis

I’d like to piggy back on this topic to offer our use case for why we currently require particle ID during end user WiFi setup.

We currently have a web application that uses a webAP + the JS SDK to build a custom solution to fit our needs. This custom solution ties the product (particle_id) to a user_id after the product is successfully setup by the end user. Everything works as intended here.

However, we are currently in the process of porting this web app to Native using react native + your native WiFi pairing SDK and have this same issue as @CBecker . We cannot get particle_id from the product during the end user WiFi setup process, like we did with our web version. This is required so that we can associate user accounts with a specific product.

Here is a depiction of the flow a particle chip takes from production to customer use.

Seeing as you can get the particle_id by simply visiting 192.168.0.1/device-id while connected to the device, should this same data not also be available to the Native setup flow?

If there is something I’m missing or should be doing differently, I’d love to hear.

1 Like

My bad, since I haven’t built this lib myself, I don’t know every feature it has :frowning:

[self dismissViewControllerAnimated:YES completion:^{
        [self.delegate particleSetupViewController:self didFinishWithResult:[state integerValue] device:device]; // TODO: add NSError reporting?
        if ((!device) && (deviceID)) {
            if ([self.delegate respondsToSelector:@selector(particleSetupViewController:didNotSucceeedWithDeviceID:)]) {
                [self.delegate particleSetupViewController:self didNotSucceeedWithDeviceID:deviceID];
            }
        }
    }];

I now see there’s another callback which does exactly what you are looking for - it returns device ID for scenarios where SDK does not return instance to ParticleDevice.

I think the main reason for not returning ParticleDevice instance is because ParticleDevice is much more than just a model class. It has a “reference” to device on ParticleCloud and therefore it allows you to update, rename, ping, etc. that particular device. Since in setup-only mode that link does not exist, it would be incorrect to return full reference. However there’s backup callback that only returns Device ID.

Please let me know if you have trouble using it or for some reason it misbehaves :slight_smile:

4 Likes

It works, thank you. Do you know if this is going to be included in the Android library soon?

1 Like

@jensck_particle can you reply to last question? Is there anything like that in Android Photon Setup Lib already?

Thank you this works!!

1 Like

Have you been able to look into this matter? Thank you!

Thanks for that snippet @Raimis it worked for iOS!

However we are still running in this issue on Android. @jensck_particle are there any functions that are available to us that we may be missing? Again, we are looking for particleID during WiFi pairing.