Get/parse item options values (and count) in rules?


is there a way to access/parse the values and amount of the OPTIONS, an item can have ?

I would like to have a radio staiton + and - Switch, which switches to the next or previous Radio Station. I have to send the String to the Item. The possible values are stored in the Sonos radio (or favorite) options. I would like to read them dynamicaly, instead of copying them into the rule manually.

This is, what i am trying to read:

Thanks for any hint,

The REST API returns a JSON string. You can extract the values from the string with a transformation.

You also can use this bit of code.

    YourItem.getStateDescription.getOptions.forEach[option |
        logInfo("options", "Option {}: {}", option.getValue, option.getLabel)
        // Do stuff
1 Like