I read these options as follows: {{getItem(config.scenes_1).stateDescription}}
But now I want to read and display the “active” label.
Unfortunately, the command “{{getItem(config.scenes_1).stateDescription.options.label}}” doesn’t work.
How can I read and display the label of the active scene?
getItem(config.scenes_1).stateDescription.options returns an array of objects (everything between the [...]), not a single object. You first have to find which element in the array is the one with the matching value using something like the findIndex method:
Once you have that element’s index, then you can get the label of that individual element with
Justin and I are assuming you mean to do this in a MainUI widget. Are you trying to get this from somewhere else, like a rule perhaps? If in a rule, which language?