Change item state text to custom text

Hi there,
is there a way how to change item state to custom text?
I have SmartThings multipurpose sensor and Item representing contact. But I see as result false or true (true when closed, false when open)
I would like to see Open instead of false and Closed instead of true.
Can I achieve this by adding some metadata? Or differently?

Maybe. Where are you looking at it? A Contact type Item will have states OPEN or CLOSED. But a binding may suggest default labels for those by supplying stateOptions. I don’t know if the binding you’re using does that,but there aren’t many other ways to get the claimed true/false.
You can “translate” the real OPEN/CLOSED state to anything you like using a transformation,probably a MAP type.

hmm … because when I created channel fype that multipurpose sensor with channel type String (text value) it is showing me false/true as output
If I create for the same Thing channel type Open/Close contact then I have always NULL :frowning:
I do not know why

Okay, I should have asked what the Item type was instead of assuming contact just because you mentioned it.

Okay, you have a String type Item now. Simplest would be to use a profile on the channel of type transform, with a MAP to convert channel’s “true/false” to "Open/Closed"or whatever you want in your string.

Because you cannot usefully link a string type channel to a Contact type Item unless it only ever says OPEN or CLOSED.
You could actually do that with a profile and MAP as above,but this time translating toOPEN/CLOSED.

Thanks - I installed Transformation MAP and now I am able to see desired texts

btw different topic but maybe I can get answer here and not to open new topic > how I will find the command syntax?
I was trying to do Rule if sensor is open then brightness of light to 40, if the sensor is closed then brightness of light to 40. I am able to regulate light brightness but with slider so I do not know the code behing
I am doing this in openhap web application (not in configuration files) and there is line saying “Comand to send”



Find your events.log so that you can view commands issued from your UI

Textual rules

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.