openhab / org.openhab.ui.habpanel

OUTDATED repo - HABPanel has moved to the openhab-webui repo!
https://github.com/openhab/openhab-webui
Eclipse Public License 1.0
97 stars 93 forks source link

Add a thing configuration value selector #316

Open hww3 opened 5 years ago

hww3 commented 5 years ago

It would be nice for custom widgets to be able to specify a configuration value type of "thing" that generates a selection list of things (as is possible to do with items).

ghys commented 5 years ago

Actually not too sure about this. openHAB has a concept of items so that end user interfaces like HABPanel remain oblivious of the underlying physical side (things) and only see the functional model (items).

That's why HABPanel doesn't know about things and doesn't use them anywhere. Getting the list would also imply calling an additional API.

hww3 commented 5 years ago

Well, I guess my rationale is that:

Modeling every situation in terms of Items isn't always feasible or desirable (hence, for example, the possibility of custom event types).

Things can emit events, so it seems conceivable that you'd want to filter based on a particular thing. Not being able to have a pick list populated with Things means you have to find the thing somewhere else and then copy-paste it into a text field.

Other portions of the OpenHAB infrastructure provide for a configuration context type of "thing", so it seems reasonable from a consistency of functionality standpoint.

In terms of implementation, it involves similar infrastructure as is used for items (actually, it's almost identical with the exception of the data type names).

See my current implementation of this feature: https://github.com/hww3/org.openhab.ui.habpanel/commit/401c8e811be4263092d529c55d4c5c8d589d5220