Naming of items


I have a question about the naming of items.

I would like to assign different names and icons to an item, is this only possible by creating another item with “Things → Add Link to Item” or are there other possibilities?

My intention is the following I have several groups (Icon) like Location_Home (house), Home_Door (door), Home_Window (window) and Home_Bath (bath), Home_Bath_Door (door), Home_Bath_Window (window). In Home_Door and Home_Window are respectively all doors and windows of the whole apartment and in Home_Bath_Door, Home_Bath_Window only from the bathroom.

Now let’s do a mental game: I go into the house (Location_Home) and have the possibility to look at all windows (Home_Window) or all properties that the bathroom (Home_Bath) has. First, I want to go to the bathroom and look at the properties of the window (Home_Bath_Window). Now I see the state, if it is open or not ItemName: Bath_Window_State_Contact ItemLabel: State ItemIcon: window. Then I go back to the beginning (Home) and now I want to look at all windows (Home_Window), if I use the same item, I see several ItemLabel: State ItemIcon: window, because they are all configured that way, in the view that I enter the rooms first. But now I want to distinguish faster which window belongs to which room, for this I create a new item via “Things → Add Link to Item” ItemName: Window_State_Contact _Bath ItemLabel: Bath ItemIcon: window (dynamic) or bath. For me it wouldn’t make sense to rename the item (Bath_Window_State_Contact) e.g. to “Bath State”, “Bath Window”, “Bath Window State”, because I know that I’m in the bath and that I’m looking at the window, then I don’t need double labels.

Now I want to configure the Semantic Model in OH3 (or I use OH4 Snapshot). If I assign all items to rooms only, it works without problems. Now I want to configure the equipment (Home_Window (Semantic Class: Window)) in the location Home (Location_Home). If I use the item (Bath_Window_State_Contact (Semantic Class: OpenState)) it disappears from the overview of Home_Bath_Window (Semantic Class: Window). I could now use the newly created item (Window_State_Contact _Bath (Semantic Class: OpenState)) but is the window in the tab: Equipment → Windows (Overview Page) duplicated.

My goal is that in the Location Overview (Image: 2 (Location)) at Home (Location_Home) also the icon (red circle) shows how many windows are open in the whole apartment.

The images in the attachment have the following configuration that start with 1: Item (Bath_Window_State_Contact) assigned only in the bathroom (Home_Bath_Window) and 2: also in Home (Home_Window)

Image: 1 (Model) / 1 (Location)

Image: 1 (Location_Bath) / 1 (Location_Home)

1 (Location_Bath)1 (Location_Home)

Image: 1 (Equipment Windows)

1 (Equipment Windows)

Image: 2 (Model) / 2 (Location)

Image: 2 (Location_Bath) / 2 (Location_Home)

2 (Location_Bath)2 (Location_Home)

Image: 2 (Equipment Windows)

2 (Equipment Windows)

There are, of course, other ways to create an Item. But yes, the name of an Item is its unique identifier. An Item cannot have more than one name. And each Item has only one icon and label. So you’ll need a separate Item.

Other ways to create an Item include from the Settings → Items page, the Settings → Model, text files, through the API Explorer itself, and the Karaf Console.

But this smells a whole lot like an XY Problem…

And so it is. Your real question is how can you have a functional view and a physical layout view in the semantic model. And the answer is you can’t. The semantic model only supports the physical layout. And since nothing can be in two places at the same time, in the semantic model any Item can only be a member of one other semantically tagged Group. If you add it to more than one it breaks the Model view.

You must create your functional model outside of the Semantic Model. And you don’t need separate Items for that, just separate Groups. However, it’s up to you to build the UI widgets to represent this model. The functional model is pretty much arbitrary with each user having their own goals and ideas. So there really isn’t a way to generalize that and automate it. You have to build the UI yourself.

I’m not sure that’s possible right now. But it’s worth filing an issue to request that higher level Location cards summarize the temps, windows, etc. of those locations under it.

Thank you very much for this answer.

Is this the right address to report the problem?

Can they please explain to me how I can represent this with groups only?


Decide what you want to “summarize”. For example an Item that is ON if any light is ON, or a count of the lights that are ON or the average of all the temperatures in the house, etc.

In Settings → Items, create a new Group. choose a type and aggregation function that is appropriate.

Add the Items as members of the Group as desired. The aggregation function will populate the Group’s State based on the states of all its members.

Sending a command to the Group Item will forward that command to all its members (e.g. turn off all the lights with one command).

On the UI, you’ll have to create your own widget to represent that Group. The oh-repreater card is particularly useful for this.

Yes, I already know that, if the group should only execute a function, but if I want to use the group for the UI like e.g. Layout Page → Cell (Action: Group details), then I need again for the item another name and icon.

No you need to create a custom widget where you can set the names any way you want based on an expression. The same can be done for the icon.

A picture to illustrate. I think we are talking about different things

component: oh-label-cell
  action: group
  actionGroupPopupItem: Home_Window
  item: Home_Window
  title: Window
  stateAsHeader: true
  expandable: false

I don’t know that we are talking about different things or not.

See Service Status Standalone Widget for the sort of thing I’m talking about.

Yes, of course if you just create a generic oh-label-cell widget, what you have is what you get. But widgets have almost infinite opportunities for customization.

But I certainly can’t tell a widget how to display group members.

When I come from Bath_Window the ItemLabel shows me Status and when from Home_Window the ItemLabel shows Bath.

Then there is the question of what would require more server resources. I think a second linked item because the item is constantly making all the update changes and the widget is only called when needed.

You certainly can.

See oh-repeater - Repeater | openHAB, the widget I linked to above shows an example of using oh-repeater to show both the Group’s state (in the header) and all of the Group’s members as a separate entry.

This is almost never something you should worry about. The server resources required for home automation are exceptionally low.

Ok, I’ll have to take a look at that, thanks for that information.