Different labels for the samen Number

What I would like to have:
I would like to be able to create different kinds of groups. In one kind all sensors of one room should be displayed and in the other all e.g. temperature sensors of a appartment/building should be displayed.

The problem
It is easy to just add a single number to different groups. This is how I have added “Numbers” in my *.items file.

Number nOGZimmerEssenCO2 "CO2-Gehalt [%.0f ppm]" <co2> (gOGEssen, gOGCO2) { knx = "<9.008:3/3/145" }

The problem is that I now have the appropriate label to use in the group gOGEssen but it is rather strange in the group gOGCO2 as here all values will have the same label.

How I tried to solve this
My first approach was just to define each number twice as shown here:

Number nOGZimmerEssenCO2 "CO2-Gehalt [%.0f ppm]" <co2> (gOGEssen) { knx = "<9.008:3/3/145" }
Number nOGCO2ZimmerEssen "Essen [%.0f ppm]" <kitchen> (gOGCO2) { knx = "<9.008:3/3/145" }

This was fine at first but has a view problems.

  • I need to define twice as many numbers (or perhabs more if we like to groupe them in additonal ways - e.g. allbBathroom humidity levels in the different appartments) compared to using the same number in both graphs.
  • My databace is inflated with identical values.
  • The project complexity is increased (hopefully without the need to)

My Question
Is there a way to only set the label of a number once it is used?

I have been able to do this if the number is displayed as text in this way:

        Text item=nAllDGCO2ZimmerBad label="tests [%.0f ppm]"

However this did not work for charts where I tried it as:

Chart item=nAllDGCO2ZimmerBad label="tests" period=h refresh=60000 

Closing Words
Thanks in advance for all your advice!

Hi there,

I still haven’t found a solution to this problem (to be honest I had not much time to figure someting out).

As there hasn’t been a single response to the question however I am wondering if my question is badly formulated. If you do not understand the question or simply think this is not possible please just post a quick responce.

Thanks in advance!

In openHAB there are two ways of defining how to present your data (e.g. a number item from a temperature sensor). You can define the so-called label (i.e. the text to be shown in the web UI) in the .items file like you have done above, and then in your .sitemap file simply refer to the item.

Alternatively, you can skip the “label” in the .items file and instead define the “label” in the .sitemap file. In that case you can define different labels for the same data - using different .sitemap files (or different sections in the same sitemap file).



Number nOGZimmerEssenCO2 (gOGEssen, gOGCO2) { knx = "<9.008:3/3/145" }


Text item=nOGZimmerEssenCO2 label="CO2-Gehalt [%.0f ppm]" icon="co2"


Text item=nOGZimmerEssenCO2 label="Essen [%.0f ppm]" icon="kitchen"

Myself, I prefer to keep definition of items strictly separate from how the data (items) are presented so I never use labels in the .items file.

I hope this helps.

The problim with this is that I am unable to assing a label to the number if I use it in a chart

Text item=nAllDGCO2ZimmerBad label="Essen [%.0f ppm]" icon="kitchen"
Chart item=nAllDGCO2ZimmerBad label="Essen [%.0f ppm]" period=h refresh=60000

gives me this:

Thanks for you help!

OK. I think I misunderstood your question (problem description). As I understand it now, what you are asking is how to change the label in the Chart legend (the square box in the chart) so that it shows some user-defined text instead of the item name. Is this correct?

If so, I am sorry to say that I do not know the answer.

That is precisly the part of the question that still remains.

Thanks for your help in any case.