I’m trying to achieve the following:
In the UI, have a control that allows to switch between three states:
Off, OnDimmed, On
The corresponding channel is just a number from 0 to 100. It’s a Dimmer and the number represents the brightness.
I would like to translate Off to 0, OnDimmed to 20 and On to 100.
But according to my understanding of the documentation, I can translate from the Channel value to my discrete states, so that they are stored in the item. But it won’t translate from the item to the channel, when I’m changing the item value.
Is that right, am I missing something?
No, you’ve got it. The transform Profile is only one way. It’s not clear exactly what you are trying to do but I can see a couple of options.
Keep the Item a Dimmer. That most correctly represents the state of the Item anyway. In the UI, create a custom widget that shows the three options (list separate buttons, what ever) and when clicked sends 0 for Off, 20 for OnDimmed, and 100 for On.
Create a proxy Item and a rule. The device is linked to a Dimmer Item and the UI shows your String Item. When the String Item is commanded, one rule translates that to the proper dimmer value to command the Dimmer Item with. When the Dimmer changes another rule translates the current dimmer value to the proper String value and updates the String Item.
Thanks for your answer. Option 1 works quite well for me, thanks!