Unique ID of Thing openHAB

I just started working in openHAB and was wondering if there was an API to get the MAC-address of an item or some other unique ID that will not change if I for example disconnect/delete the device and reconnect it.

I want the unique ID so that I can put the Thing in a database without it creating a duplicate in case it disconnects or I delete the device.

There is a Thing UID available but I don’t think that this will remain the same if you delete the Thing and re-add it…

Check: http://OH2_IP:8080/rest/things

Yeah, that is what I was afraid of, which is why I hoped to find something like MAC address, which obviously doesn’t change. I’ll check it out, thank you.

MAC is strictly a networking stack concept. Many if not most non-TCP/IP/Bluetooth home automation technologies have no concept of a MAC or if they do that is not exposed.

One Links a device to an Item using a Channel ID. Each Channel ID is the unique ID as far as OH is concerned.

For most bindings if you delete a Thing and readd the Thing will be restored with the same ID. There are a few bindings where that won’t necessarily be the case, for example the Zwave binding. When you first create the Serial Thing that represents the controller, part of the ID is randomly generated and all of the Things associated with that controller will use that randomly generated part as part of their IDs. But you have the opportunity to replace that randomly generated part of the ID with a name of your choosing when you create the Zwave controller.

But, as you can probably guess, this is going to be binding dependent.

I would be curious as to what you are doing and what your real concerns are or the problem you are acutally seeing because in the years I’ve been supporting on the forum this is the first question of this type I’ve seen.