[Solved] Things: doing my head in :(

Version: 2.5.9 (Build)
System: Host: rpi3ohv2 Kernel: 5.4.51-v7+ armv7l bits: 32 Console: tty 2 Distro: Raspbian GNU/Linux 10 (buster)

I am trying to migrate from mqtt v1 to mqtt v2 on OH2.
I would like to retain my textural configuration.
I have taken the advise to create Things and channels in PaperUI.

I have done that and created a broker thing (to the existing mosquitto); works.
I created a generic mqtt thing for a Gate Controller (the most simple controller I have amongst many).
image

The topic id is awful. Where can I change this to something meaningful?

I have created a channel:
image
… which has a MQTT state topic of:
ArgyleCourt/Property/MainGate/MAC

I have linked this channel to the item:

String   MainGate_MAC    "MAC address [%s]"    <network>   (gMainGate)         //{mqtt="<[mymosquitto:ArgyleCourt/Property/MainGate/MAC:state:default]"}

… commented the v1 link out.
This works.
image

I have then deleted the linked item, and added the channel in the item file like so:

String   MainGate_MAC    "MAC address [%s]"    <network>   (gMainGate)     {channel="mqtt:topic:56873dfe:mac"}

So it seems I grasped the very basic concept of this thing/channel business.

But still, that topic is awful… I have literally 100s of these. Is there a way to change that id into something legible?

The other issue is: I have unlinked the item from the MAC address channel in PaperUI, and then added the channel in the .items file.
While I have created new channels (Temperature and Doorbell), these showed a linked item after I added the channels to the items.
image
Do I have to link the MAC address channel with the item again in PaperUI? It works as it is, but PaperUI does not represent the linkage that exists in the .items file.

String   MainGate_MAC                   "MAC address [%s]"                              <network>       (gMainGate)                         {channel="mqtt:topic:56873dfe:mac"}
Number   MainGate_Temperature           "Temperature at gate [%.1f °C]"                 <temperature>   (gMainGate, MainGate_Temp_Chart)    {channel="mqtt:topic:56873dfe:temperature"}
Switch   MainGate_DoorBell              "Door Bell Gate"                                                                                    {channel="mqtt:topic:56873dfe:doorbell"}

Any hints appreciated.

I guess you mean the Thing UID, the 56873dfe part.
I don’t think you can edit after the fact, because it is the UID.
You can change it the first time it is offered to you, presumably using PaperUI this is when you click + to add Thing. Overwrite with “GateControl” or whatever.
Then afterwards bin the Thing you don’t like

I am sure I did this…
Just created another thing, and it did take my id.
image

Alright then… will delete the thing and recreate.
Sweet :slight_smile:
image
Is there no ‘textural’ way to do this?

Sure. OH2 introduces xxxx.things files, which work a bit like xxx.items files.
This is explained in the doc you must have read to try to understand Things


Using xxx.things file forgoes much of the syntax and sanity checks built in to PaperUI, it’s easier to make mistakes.
At least use a suitable editor like VSCode + openHAB extension to improve your chances

On the other hand, textual configurations are easier to share in this forum and you will find many hundreds of practical examples.

Thanks… for now stating the obvious :slight_smile:

Not your fault. It is mine.
As I said elsewhere, I never really got the THING.
And I read these docs before (but couldn’t make sense of it).
But, now that I created a thing in the PaperUI, the information provided, the docs make sense.
Hence, I would suggest/add: if you are into textural configuration, let PaperUI create the Thing and channels if the thing is discoverable (e.g. like Hue), but happily create your own textural thing otherwise.
… the later will significantly speed up my controller things.

And yes, I have been using VScode for a while now, and love it. In particular that is is showing the current state of items.

Also, I just did some more reading and noticed that the docs have been significantly improved! Very nice!

Also, I meant to correct the id to something more useful by editing it somewhere.
But deleting and creating the thing of course worked too.

And after the turmoil this evening (here in AU) I am a lot wiser now. Thanks again.

Lucky you it’s speaking names - what else to expect from a naming concept ?

(or if you really refer to the UID as @rossko57 wrote you can simply change that).

Just for reference. OH 3 now has a way to view and export all non-text file configs as YAML for easier editing, copy/paste/edit, copying and importing from the forum and sharing on the forum. This works for Things, Items, Rules, and Pages I believe.

And of course, .things files are still supported.