Switch state output in Basic UI shows redundant value label

  • Platform information:
    • Hardware: x86
    • OS: Ubuntu 20.04.3 LTS
    • Java Runtime Environment: openjdk version “11.0.11”
    • openHAB version: 3.1.0 release
  • Issue of the topic: Switch state output in Basic UI shows redundant value label

I use OpenHAB with a bunch of Ikea TRÅDFRI devices and today I added a new dimmable lightbulb as an OpenHAB item.

The new brightness item (BadLampe_Helligkeit) behaves differently in Basic UI, compared to an item added with an older version of OpenHAB (example: EsstischLampe1_Helligkeit).

Here is the JSON output of the /rest/items/ endpoint for the two items:

{
    "category": "DimmableLight",
    "editable": true,
    "groupNames": [
        "BadLampe"
    ],
    "label": "Helligkeit",
    "link": "http://openhab.fritz.box:8080/rest/items/BadLampe_Helligkeit",
    "name": "BadLampe_Helligkeit",
    "state": "100",
    "stateDescription": {
        "maximum": 100,
        "minimum": 0,
        "options": [],
        "pattern": "%d %%",
        "readOnly": false
    },
    "tags": [
        "Lighting",
        "Point"
    ],
    "type": "Dimmer"
}
{
    "category": "DimmableLight",
    "editable": true,
    "groupNames": [
        "EsstischLampe1"
    ],
    "label": "Helligkeit",
    "link": "http://openhab.fritz.box:8080/rest/items/EsstischLampe1_Helligkeit",
    "name": "EsstischLampe1_Helligkeit",
    "state": "58",
    "tags": [
        "Lighting",
        "Point"
    ],
    "type": "Dimmer"
}

In Basic UI I use the same controls for the old and the new lightbulb:

        Frame label="Bad" {
        Switch item=BadLampe_Helligkeit icon="switch" label="An/Aus"
        Slider item=BadLampe_Helligkeit icon="light" label="Helligkeit [%d %%]"       
    }
        Frame label="Esstisch" {
	    Switch item=EsstischLampe1_Helligkeit icon="switch" label="An/Aus"
   	    Slider item=EsstischLampe1_Helligkeit icon="light" label="Helligkeit [%d %%]"	    
	}

But the output looks different, for new newly created item, next to the switch state output, the current brightness is shown:

I would guess the the stateDescription property of the newly created item causes the output in Basic UI.

So, here is the question: How can I remove the redundant label with the lightbulb brightness next to the switch state output?

Try adding an empty “[]” to the label.

"An/Aus []"

Wow, thank you very much for your fast reply.

It work perfectly fine :slight_smile: !

Hi Rich,

I had the same problem. The square brackets did the job.
Why is this different from older OH versions?

Because OH 3 introduced the State Description which is used all over the place in OH 3 to describe how Items states should appear by default, among other things. BasicUI will use that default unless overridden. The square brackets overrides the default.