Suggestion - Naming of Things/Items/Points etc

Hello,

I’ve been utilizing OpenHAB for several years and have integrated a significant number of Things and Items into my setup. Throughout my experience, I’ve found the naming conventions for Things, Items, and Channels to be somewhat perplexing, making it challenging to identify the correct components.

To enhance clarity and ease of management, I propose that every Thing, Item, Channel, etc., be assigned a permanent, unique ID alongside a customizable DisplayName. This approach would ensure that while all backend processes, such as Rules, reference the immutable unique ID, the user interface would display the more intuitive DisplayName. This system would streamline identification and modification processes, making the management of components more user-friendly.

The list of Items that I see when I add Items to a Scene looks like this (this is just a small sample of the items):

Alarm (ZWaveNode023GWPN1SinglesocketPowerNode_Alarm)
Alarm (power) (ZWaveNode002NASWR01ZEWallPlugSwitch_Alarmpower)
Alarm (power) (ZWaveNode020FGWP102MeteredWallPlugSwitch_Alarmpower)
Alarm (power) (ZWaveNode007FGWP102MeteredWallPlugSwitch_Alarmpower)
Alert (Magnuslightstripseng_Alert)
AnybodyHome (AnybodyHome)
AutoLight
AutoLightOff
AutoLightOn
Battery Level (ZWaveNode011MotionSensorPIRMotionSensor_BatteryLevel)
Battery Level (Dimmertest_BatteryLevel)
Battery Level (ZWaveNode026_BatteryLevel)
Battery Level (ZWaveNode010MotionSensorPIRMotionSensor_BatteryLevel)
Battery Level (ZWaveNode009MotionSensorPIRMotionSensor_BatteryLevel)
Battery Level (ZWave_Node_027_Hall_Motion_Sensor_Battery_Level)
BedRoom
BjorkHome
Brightness (HaveWall_Brightness)
Brightness (Wc1salhvidhue_Brightness)
Brightness (LightLivingroomHue_Brightness)
Brightness (Hue_WC_Entre_Brightness)
Brightness (Wc1salhvid2hue_Brightness)
Button 1 Indicator (ZWaveNode024ZHC5010FUGAWall4waySwitchwithLEDRelay_Button1Indicator)
Button 1 Indicator (ZWaveNode025ZHC5010FUGAWall4waySwitchwithLEDRelay_Button1Indicator)
Clear Accumulated Energy (ZWaveNode002NASWR01ZEWallPlugSwitch_ClearAccumulatedEnergy)
Coffee Machine Wall Plug Switch (ZWaveNode002NASWR01ZEWallPlugSwitch)
Color (Magnusterrassevenstre1_Color)
Color (Magnusterrassehojre1_Color)
Color (Magnushueroom_Color)
Color (Magnusindgangvenstre_Color)
Color (lightstripplus1wc1floor_Color)
Color (Magnusterrasse2tilhojre_Color)
Color (HueTower_Color)
Color (Magnuslightstripseng_Color)
Color (LightLivingroomHue_Color)
Color (Magnusindganghojre_Color)
Color (HaveWall_Color)
Color (Magnusterrassevenstre2_Color)
Color (Magnuslightstriplounge_Color)

After adding Items to the Scene they are displayed differently. I think it is only displaying the name (ID) of the items, and it is really confusing and difficult to understand what is going on if something is not working as expected.

Also I could be interested in tips and tricks to make it easier for me to navigate and identify nodes like “ZWaveNode002NASWR01ZEWallPlugSwitch”.

Best regards,
Michael

I’m not sure about your concerns.
When setting up a thing, you can chose the ID yourself.
openHAB uses quite some layers of abstraction for hardware/external stuff:

  • one Binding (Add-on) per protocol/interface
  • one Bridge (if suitable) per interface/bus
  • one Thing per Device
  • one Channel per aspect/value/command/command group

Another layer of abstraction is the openHAB Bus itself. Each Item is completely independent of connected channels (at least it should).
So, when it comes to Items, you should not need to set Item names to refer to specific hardware at all, but more to the aspect which is controlled/shown by the Item.
As an example, here some of my Items:

// leading N  -> Neubau; new part of home
// leading A  -> Altbau; old part of home
//         EG -> Erdgeschoss, first floor (entry level...)
//         OG -> Obergeschoss, second floor
//         DG -> Dachgeschoss, attic
//         Rs -> Rollershutter
//     <Room>
//        ... -> Which Device in the room, if more than one

NEGRsRaeder    "Räder Abstellraum"
NEGRsTechnik   "Technikraum"
NEGRsKuecheW   "Küche West"
NEGRsKuecheN   "Küche Nord"
NEGRsFlur      "Flur"
NEGRsWoziOst1  "Wohnzimmer Ost1"
NEGRsWoziOst2  "Wohnzimmer Ost2"
NEGRsWoziSued1 "Wohnzimmer Süd1"
NEGRsWoziSued2 "Wohnzimmer Süd2"
NEGRsWoziSued3 "Wohnzimmer Süd3"
NEGRsWoziSued4 "Wohnzimmer Süd4 (Tür)"
NEGRsWoziSued5 "Wohnzimmer Süd5"
AEGRsWoziHof   "Wohnzimmer Hof"
AEGRsWoziWest  "Wohnzimmer West"
AEGRsWoziOst   "Wohnzimmer Ost"
AEGRsKuche     "Küche"
AEGRsSchlaf    "Schlafzimmer"
AOGRsFlur      "Flur"
AOGRsNord      "Nordzimmer"
ADGRsNord      "Dach Nord"
ADGRsSued      "Dach Süd"

I don’t need to know what kind of hardware will actually control the “real” roller shutter. In fact, the old part of the building is controlled by mqtt, the new part is knx.

Hi, and thanks for your comment.

I might do things the wrong way as I cant figure out how to make good names for my things/items etc and maybe later change the names I see i the user interface.

When I add things from my Inbox I might not know which device I am adding. There could be 50 new Things in my Inbox, like ZwaveNode001, ZwaveNode010, ZwaveNode002… And ill have to add them (and name them) and try them out before I know which device each of the ZwaveNodes represents.

This is a very strong argument for adding the ability to rename thing uids and item names

1 Like

It will give a large impact, though, as openHAB has to take care of all references as well.

On the other hand, it would be very nice to get a “change id” feature as this is one of the things that are very easy to do via text files, but not possible at all via UI. (changing ids via text is in fact like deleting and creating a new Thing/Channel/Item)

That’s how it already works.

For Things the unique ID is called the Thing UID and looks something like this: astro:sun:local. The “DisplayName” for a Thing is called the “Label” and it can be what ever you want: e.g. Local Sun.

Channels use the Thing ID with an additional Channel ID appended to it. Again, the “DisplayName” is the “Label”.

For Items, the unique ID is called the Item’s Name and can be relatively arbitrary though must follow a few rules (no spaces, cannot start with a number, etc). But it is permanent and the only way to change it is to delete the Item and recreate it with a new name. The “DisplayName” for an Item is called the “Label” and it can be what ever you want.

OH already implements this.

The “Alarm” part is the “DisplayName” (i.e. the label) and the “(ZWaveNode023GWPN1SinglesocketPowerNode_Alarm)” is the UID (i.e. the name).

Your root problem here appears to be that once created and Items are added to the Scene, it shows the Item name instead of the Item’s label. It’s probably a good idea to show the label by default (though as you can see the label is not guaranteed to be unique which presents it’s own problems), show both (maybe the way both are shown elsewhere with the label prominent and Item name less so as is done elsewhere like on the Items page.

image

Or have an option to switch between the two.

That’s a simple feature request to the openhab-webuis repo.

Choose meaningful names in the first place. Your Items are the model of your home automation as you use it. IMO the technology (e.g. “ZwaveNode002NASWR01ZE”) should never be used in an Item name. The Item name should be something like “Kitchen Light” or “Master Bedroom Bedside Lamp”.

Similarly, the Item Labels should inform what device it is. Instead of “Color” it should be “Living Room Ceiling Light 2”.

One thing I’m assuming is you’ve not use the semantic model. When you create “add equipment to model” you can give a meaningful name to the equipment and that name will be carried through in the names of all the Items that are generated. However, the “label” for the Items will come from the Channel label and you will likely want to modify those.

Thank you for all your feedback!

I initially set up everything using the user interface (UI) and thought changing the names (IDs) of the elements and objects was not possible.

However, I discovered that I could actually rename the Names (ID’s) of Things and Items by using the “search and replace in files” feature in Visual Studio Code. :blush: This method works well, even though I’ve already created many rules and scripts through the UI, and so far, I haven’t encountered any issues.

Being able to change the names is a significant improvement to my setup, because the names help me understand what each thing is.

I have a Semantic Model, which was partly why I didn’t focus much on naming the Things and Items initially. But, as some of you mentioned, OpenHAB doesn’t display these names consistently throughout the application. In some places, the name (ID) is all you see, making it hard to understand what’s happening if the names aren’t descriptive.

However, I’m really happy because I managed to successfully rename them. :blush:

Thanks again.

Did you do this on the files inside jsondb directory and then restarted openhab?

I performed a “Search and Replace” on all files and folders within the entire OpenHAB project. My names were extremely long, so I believed there wouldn’t be any issues with matching the same text in other places.

I’m not certain where the replacement actually happened.

did you restart openhab afterwards?

Yes

And I took a backup before renaming!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.