Device identification

Hi,
I am thinking about the best way, how to identify devices - how to identify from which device are data. I am using “bc_radio_pairing_request(“climate-module”, VERSION);”. Then the device is identified as “climate-module:0”. When I pair new device with same name, it will be named as “climate-module:1”. It is OK. But what about when I remove the first device? Does the second one will be renamed to “climate-module:0”?

Is there any way to identify every device by some unique id? Probably there is some function in the SDK how to get device ID (for example climate-module-abcd1234657890). But it is significantly increase topic length which is about 50 characters. I don’t know how id is generated, if is possible to use only some four characters from the id or something similar.

Do you have any idea? The goal is that I need to recognize data from every device and it can’t be affected by the order of how devices are connected to the gateway.

Thanks for any ideas!

Just for clarification, I am lookig for something like this:

  • connected device A as climate-module → climate-module:0
  • connected device B as climate-module → climate-module:1
  • connected device C as climate-module → climate-module:2
  • disconnected device A → all devices will have same identificator
  • connected device D as climate-module → climate-module:3
  • connected device A as climate-module → climate-module:0

I don’t have enough devices to try it, I am not sure if it works as I wrote above or not. (I am afraid, that when I connect device D, it will be identified as climate-module:0)

Hi,

yes the devices can be shuffled. The algorithm generating alias is simple and always checks if the climate:0 :1 and so on is free. So if you unpair climate:0 and pair other one, it will be named climate:0.

Only fixed name is the device ID, you can use the ID instead of alias.

node/e5f96ea4caa4/barometer/0:0/pressure

This way you can be sure it is still the same Core Module.
Unfortunatelly it is not possible to shorten this ugly ID, you have to use all of it.

UPDATE:
In Playground there’s a bug that it does not support sending to IDs right now. But in the bcg and raspberry-pi its working ok.

Martin

Thank you… it is the way - use ID instead of alias. But the topic length is the issue… I am not able to shorten my topics more. Are you planning to allow longer messages than 50 characters? Why it is restricted to just 50 characters?

Hi,
to which topic length limit are you reffering?

You mean that custom topic subscription on the Core Module you was troubleshooting in the other forum thread? Over the radio only the part after node/{id}/ is send over the radio. The “node/5a5fa5e5fa4” prefix is not send overt radio. This is automatically prefixed in the bcg in your computer. So it should not matter how long your alias or physical address is.
I’ve asked @Karel to add his answer to this thread, he knows the radio inside out.

Martin

Yes I thought custom topic subscription, but you are right, that these topics are without device identification. I am sorry for confusion. So it is great idea to use device id instead of alias.

Are you planning to allow to send more than about 50 characters over the radio or it is colliding with some ideology of low power consumption devices?

It is limitation of radio protocol/packet. Each packet has maximum 64 bytes. Subtract some headers, addres field, some bytes with flags and you have around 50 bytes for data.
You can change packet length but it will not be compatible with bigclown.

Martin

Thank you, at this moment I understand how it works and why. It is good! Yout idea about identifying devices by ID is very good and it works very well. Thank you!

1 Like