User state for contact item

  • Platform information:
    • Hardware: _Raspi 4B
    • OS: Raspbian
    • Java Runtime Environment: 17
    • openHAB version: 4.02

Hi,
I’m using a non semantic item of the contact type for storing a binary state, generated by a rule. Contact type items can represent the state OPEN or CLOSED so I update the item with these values.
Is the transformation of these states via .map-file the only way for a user defined text to display in the item or is there also a possibility by adding state descriptions to the item?

Michael

You could use state description with an inline script transformation.

1 Like

I’ve never done that. Can you please give an example with OPEN/CLOSED transforming to for example Day/Night?

Oh, that was easy: Simply added two lines under “Options”:
CLOSED=Night
OPEN=Day
Worked. :ok_hand:

1 Like