Particle Subscribe response not reaching Boron

Hello,

I have some boron that are under a product which aren’t owned and they are not receiving the subscribe events, but the ones that do have an owner are receiving the events. Does this have to do with the Particle.Subscribe? This is the current Particle subscribe

Particle.subscribe(System.deviceID() + “/hook-response/siteListRequest/”, receivedSiteDataOp, MY_DEVICES);

Would I remove MY_Devices so the units could receive a response? Is there an easy way to assign ownership to all of these device?

Thank you for your help!

Sincerely,
Matt

It is not possible to receive any events for unclaimed devices, even in a product. This is true whether MY_DEVICES is specified or not.

In order to receive any events on a device, you must claim the devices. You can claim all of the devices to a single account, but they must be claimed.

Hey,

Thank you for getting back with my. How would I go about claiming all of the devices if I already have them out there?

Sincerely,
Matt

In order to claim a device:

  • You need to know the device ID (which you should, since they’re in your product)
  • It must be online and breathing cyan (somewhere, not necessarily where you are)
  • Not already claimed to an account

It’s generally simple if your devices are on all the time. If they use sleep and only wake up for brief periods it’s a little trickier, but can be done by monitoring product online events from a server by SSE and then immediately requesting a claim using the Particle API during the brief period it is online.

The devices are all remote. Can I claim using CLI or do I have to use the API?

You can claim using the CLI even if the devices are remote. particle device add works from the cloud-side, not via USB, which is why devices need to be online and breathing cyan to claim.

Thank you! So just so I’m clear there is no way to claim devices while they are offline?

There is no way to claim a device that is offline, because part of the claiming process is that the cloud needs to do a handshake with the device, so it must be online.

Incidentally, while the device needs to be claimed to receive an event by subscription, an unclaimed product device can send events and receive function and variable calls. Using function calls to respond to an event sent by the device is a common scenario for cloud to single device. For cloud-to-many or device-to-device you still will probably want to use a subscription.

Thank you sir! I appreciate the help and detail.

Hey,

I just tried claiming an offline device and it says that it was successfully claimed in particle CLI and it reflects me as the owner now? Is this something new?

Hmm, it looks like the behavior has changed. If a device is currently unclaimed, and is a product device, you can now claim the device to your account while it’s offline. That is a useful improvement, I don’t know how I missed that.

Thank you for confirming! I’m very happy to see this.