[SOLVED] Kodi binding - playfavorite in rules, what is the syntax?

Hi,
I would like to play a certain favorite (lets call it Favorite1) which is a radio station, in a rule.
I managed to play it with playuri:

myKodi_playuri.sendCommand("plugin://plugin.audio.tuneinradio/?logo\u003dhttp%3A%2F%2Fcdn-radiotime-logos.tunein.com%2Fs0q.png\u0026id\u003ds218965\u0026name\u003dRadio+101+Rock\u0026path\u003dtune")

but as you can see its ugly.
is it posible to have something like
myKodi_playfavorite. - how to tell him to play Favorite1 ?

I have playfavorite as a selection in sitemap and it works nice, but I have to select a favorite which I want to play.

thanks,
regards,
Vanja

If I understand the question correctly, you can create a map file and use the transform Action to convert “Favorite1” to “plugin://…”.

Hi Vanja,

The favorite selection is populated dynamically during runtime. In general all options - so called StateOptions - are a list of label and value pairs (label and value are the same in Kodi binding). You can use the same item to send a command (=value) of your favorite towards Kodi:

myKodi_playfavorite.sendCommand("Favorite1")

It is possible to access the whole list of state options in a rule and work with them:

myKodi_playfavorite.getStateDescription.getOptions.forEach[option |
    logInfo("kodi", "Favorite: [label='{}', valueid='{}']", option.getLabel, option.getValue)
]

thanks a lot! works great!