openhab-core: Transformations ignored, when state description options are available

I’m using openHAB 3.1.0.M3 on docker.

When defining an item with a transformation to change the displayed name, the main UI ignores the user supplied transformation and gives precedence to the “State Description” options.

In the example snippet below, taken from the REST call to rest/items/Kinderzimmer2_Sicherheit_Fensterkontakt, the options are set by the homematic ip binding and therefore cannot be changed or deleted.

...
"state": "CLOSED",
"transformedState": "geschlossen",
"stateDescription": {
  "pattern": "MAP(de-default.map):%s",
  "readOnly": true,
  "options": [
    {
      "value": "CLOSED",
      "label": "Window status: locked"
    },
    {
      "value": "TILTED",
      "label": "Window status: tilted"
    },
    {
      "value": "OPEN",
      "label": "Window status: open"
    }
  ]
}
...

Item state in main UI is displayed as Window status: locked instead of the transformed state geschlossen.

The following map file was used:

TILTED=gekippt
CLOSED=geschlossen
OPEN=geöffnet
=-

For MAP transformations a workaround would be to type in the mapping from the mapping file into the options field of the state description. Configuration for the state description then looks then something like this:

value: " "
config:
  options: TILTED=gekippt,CLOSED=geschlossen,OPEN=geöffnet,=-

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments

If you do that, will the options ever get considered when any of the channels linked to the item has a state description?

Yes but only if there is no transformation.