Basic UI - get location from thing

If I use paper ui, or look at a thing file, I can see a thing having a location if I’ve set it, eg my zwave controller @ Cupboard as the thing defintion.

Is there a way I can pull this information as an item so that I can expose it to basic ui? I have a number of zigbee2mqtt routers, helpfully named zmrouter01 - 06. Now I coul dgo and update their topics or just their item names, but I figured I have loaded the location as part of the thing definition, so should be able to use that.

As far as I know, that location is only used by PaperUI in the Control tab. The best way to solve this is to change the Item names to be more meaningful. If you want to create a model to show that the controller is in the cupboard you would use a Group.

OH 3’s new UI provides a way to manage models like this even more fully.

I did have a look at getThingStatusInfo(“mqtt:topic:z2mrouter01”).getStatus() - but that doesn’t seem to get the the location. And I wasn’t sure if I could as part opf a group, get the thing UID.

I think I’ve seen other forum posts that look like they’re OH3 that allow more around this area.

I did also think of pulling via rest, but ideally i’d want the thing UID so I can loop to populate an item.

The model has been there for a long time. It’s just OH 3 now has the UI to do it instead of needing to do it all manually through Group membership, Item tags, and Item metadata. See HABot Walkthrough (2/n): Semantic Tagging & Item Resolving.

At the end of the day, you can go through a whole lot of extra work and effort, or you can just given your Items a meaningful name and even if you don’t do a full semantic model you can use Groups to represent rooms. That will be a whole lot less work and really that’s how you should use Items anyway.

BasicUI can only show Items. So anything you want to show on it has to be an Item.

1 Like

Boo, that seems decidely low-fi :stuck_out_tongue:

Why would you use that first model (tagging) when a thing is already set in a location either in PaperUI or a thing file? It seems like double handling.

Pity, I was hoping I could just get a thing uid from a item in a group.

PaperUI was created by a third party who no longer supports it. I believe the intent was to use Location in combination with automatically discovered Things and Simple Mode to populate the Control tab as the only interface. But PaperUI never advanced to the point where the Control Tab was actually useful. Every other UI in OH operates on Items, not Things so it was never made available to any other part of openHAB and no one ever made any effort to try and use it. It’s also extremely limited compared to semantic modeling (e.g. it doesn’t handle the case where one Thing might represent a sensor or actuator in more than one location, one “device” is represented by more than one Thing, sometimes from different bindings even).

Obviously, openHAB never got to that point so the location tag on Things is pretty much only used by PaperUI, and PaperUI is gone in OH3. But the fact remains that BasicUI has only ever supported Items so even if it were used it would not be available in BasicUI.

The problem with that is which Thing ID? An Item can have 0 to N links to Thing Channels.