Basic Mesh: How to identify each Xenon


#1

Hello all, this is just a basic conceptual question. I am just learning about how the Xenons and Borons can communicate via Mesh.subscribe and Mesh.publish(event_name, event_data). I understand there can only be 5 subscribed events within each Mesh network. And that event_name consists of a prefix and suffix. When you subscribe you only subscribe to the prefix.

How do you identify a Xenon? I know you can use https://docs.particle.io/reference/device-os/firmware/xenon/#get-device-name
However that relies on contacting the cloud. Is there another way that a Xenon can identify itself? I don’t want to have to send unique code to each Xenon. Unique meaning that the only difference is a variable called myName = “Xenon 5”;

Is there any tutorial or walkthroughs on basic Mesh communication?


#2

You could extract the device ID from within the firmware and use that to identify each xenon.

https://docs.particle.io/reference/device-os/firmware/xenon/#deviceid-


#3

Oh thanks, I scrolled right over that one. Are there any examples of using the prefix and suffix of an event name for performing Mesh communication?


#4

I don’t know if any specific examples have been published but theoretically it can be done.


#5

Anyone know how to get a device name from a device ID but not the device that is requesting the name?

I have a Mesh network of Xenons and a gateway based upon a Xenon in an ethernet featherwing; the endnode Xenons do not have cloud access but rather register themselves with the gateway as they join the mesh. I would like to publish data to the cloud with the endnode device name rather than the device ID but I can’t see an obvious way to have the gateway get the device name for another device knowing the device ID other than the subscribing to “particle/device/name” event and taking the device name from the data in the event received? If I use the cloud API then I also need the access key?


#6

If it’s one of your devices you can use particle list this will give you a list of device IDs with their corresponding device names.

From a device you should be able to use a webhook hitting this cloud API


#7

Thanks - still would need to hard code the access key into the webhook - I was hoping to avoid needing to do that.


#8

You can send the access token too.
However, it would be nice if there was a way to skip the need for the access token (or use some “internal” token shared between devices of a particular account) when a request originates from the same account.

@rickkas7, do you see any way to do that?