Add location in discovery service

Can I add proposed location for thing when I’m creating DiscoveryResult? I do not see this option in DiscoveryResultBuilder.

The code that I use for building DiscoveryResult

DiscoveryResultBuilder.create(thingUID)
    .withBridge(findBridgeUID())
    .withProperties(properties)
    .withLabel(label)
    .build();

Location is property of a Thing once it is created. DiscoveryResult describes thing but apparently location is currently missing there.

I believe your finding is worth of reporting in form of issue since some hardware or even cloud integrations might have metadata with location information such kitchen or living room.

Thanks for the info. I will create feature request

Actually, thing “location” is deprecated. I don’t think that a feature request will change anything.

@David_Graeff thanks for info, can you point place from where deprecation message comes from?

Code as of today does not reflect depreciation:

The concept is deprecated, not the API. I think I’ll make a PR today to deprecate that method.
Location was purely added for PaperUI and PaperUI is deprecated.

Does it means that Things do not have a location for OH2 ?
Or maybe is handled as (semantic annotated) tags ?
In this case a suggestion in the deorecation msg would be to store location data in tags and not in object

Things are not for UI usage. Items are. Things don’t have a state, channels also don’t, just items.

Exactly. On the item level. A channel can propose item tags on item creation though, this way the binding developer has some influence on item tags.

What will be used instead of paper UI?

@David_Graeff

I’ve been avoiding trying to post until all the fallout from changing everything but your comments have spurred me to ask - what if a thing can propose UI considerations?

I’ll give you an example: Russound Whole House Audio. There are two aspects that I’d like you to comment on.

  1. Each room has a zone thing with a set of channels. Each Russound zone know’s it’s location (ie the russound system knows - so therefore the thing know). Seems like it would be great if the thing can give a hint to a UI as to it’s location…
  2. A more rare example - the Russound API incorporates UI related activities. So, for example, if I select a USB source - I could see all the folders in the source, select a folder, see all songs, select a song, etc - all with the api (it’s alot more complicated than that - but it gives you an idea). Right now - I hack this into the system by having a channel produce a json string related to the UI information - and then a special habpanel addon that will use that json information to show the actual UI. I’d love to see something like that more formalized (and less hacky like I did).

Keep up all the good work!

Tim

1 Like

Just add a location tag to each channel of that thing. That way all items linked to those channels will have that tag. The tags to be used are even standardized, see semantic tagging here in the forum.