OH3 UI: Drop-down selector as widget from String item?

Hi all,

I’m struggling with the OH3 UI / widget concept in the Pages section. Either I’m getting old or still not very good in those things.
Well so I got a Nanleaf (Shapes / Triangle) and configured it according to the Binding example. There is one Item which let’s you choose the effects on nanoleaf:

String NanoShape1_Effect  "Effect" { channel="nanoleaf:controller:B91E55FD80F6:effect" }

If one looks it up under Item it’s a string item where you can click on and can select all the available effects uploaded on the Nanoleaf device. Now I would like to get this drop-down menu also as a widget into one of my pages. I haven’t understood how a String Item does become a list and how I could make this list a selectable drop-down in the UI. So anyone willing to reveal the secret to me?

Thank you a lot.


In OH when there are presents like this for an item (and this is very common with string items) these are the command options. Sometimes, as in your case they are automatically defined by the binding, and other times they can be manually defined by using the commandOptions metadata in the item details page.

Because these are so common, there’s a quick built-in way to take advantage of these. One of the actions that can be defined for any of the widgets that use the action system is “Command Options”. This will automatically turn those presets into the popup that lets you select one.

If you’re putting this directly on a page, then most likely you want a label cell or a label card as your base widget. Set the main widget item as your string item so that the card/cell shows you the current item state. Then, under actions choose “Command Options” and again set your string item as the action item as well (so that the UI knows which Item to look in for the presets).

Now, clicking on that card/cell will bring up the list of preset for you to click on.

1 Like

Wow. in 100 years I would not have found / got that. That was exactly what I was looking for.

@JustinG Thank you a lot!