How to display an item sitemap value and not the actual value in widget?

  • Platform information:
    • openHAB version: 3.3.0

I have a newbie question but I could not find the answer by searching this forum.
I want to display an item’s “mapped value” in a widget and not the item “raw value”.

I have an openwebnet item defined like this

String                thermo_1_Living_offset      "Local offset"                                   (gLivingRoomHeating)                                      {channel="openwebnet:bus_thermo_zone:MH200N_Gateway1:thermo_1_Living:localOffset"}

The item value from the doc of the binding (OpenWebNet (BTicino/Legrand) - Bindings | openHAB) is one of the following values :

The zone local offset status: OFF , PROTECTION , MINUS_3 , MINUS_2 , MINUS_1 , NORMAL , PLUS_1 , PLUS_2 , PLUS_3

But there is a mapping somewhere that matches e.g. : ‘MINUS_1’ = ‘-1’
In the developer sidebar, it shows as expected :


I’m trying to update an existing widget and display the ‘-1’ and not the ‘MINUS_1’

But in my widget, it shows the ‘MINUS_1’

Here is the yaml portion of the widget (the item is props.targetOffset):

          font-size: 12px
          position: absolute
          right: 25px
          top: 53px
        text: =items[props.targetTemperature].state + " "+items[props.targetOffset].state
        visible: "=props.targetTemperature ? true : false"

So the answer to this must be rather straightforward but I cannot figure this out :sweat_smile: :grin:

Also I do want to display the “-1” and don’t need to convert it to a number. In this case it should show “18° -1”

Thanks for any help :slight_smile:

You are looking to use the item displayState and not just the state.

1 Like

I knew it! Haha. I feel a bit dumb now :sweat_smile: :grin:
Thank you @JustinG