How can I receive all the available options for a control item in another item as a comma-separated list?

Hi,
I have the following item, which has many options to choose from.


From channel:

The options are defined externally in phoscon.
I would like to read all available options and save them in a string item to then use them later in the widget to fill the variable xx automatically.

Here is the widget with the manual-added options:

uid: Lichtersteuerung_Raum
tags: []
props:
  parameters:
    - default: Arbeitszimmer
      description: Raum
      label: Raum
      name: raum
      required: true
      type: TEXT
    - context: item
      default: Aus,Normal,Arbeiten,Party,Nachtlicht,Reinigung
      description: Kommaliste aller Szenen die der Raum unterstützt
      label: Szenen
      name: szenen
      required: true
      type: TEXT
  parameterGroups: []
timestamp: Oct 24, 2023, 9:23:15 PM
component: oh-list-item
config:
  action: group
  actionGroupPopupItem: ="Licht_"+props.raum
  icon: oh:light
  iconUseState: true
  item: ="Licht_"+props.raum
  title: =props.raum
slots:
  after:
    - component: f7-block
      config:
        style:
          display: inline-flex
          flex-direction: row
          justify-content: flex-end
          margin-top: 0
          padding: 0px
          padding-left: 5px
      slots:
        default:
          - component: oh-repeater
            config:
              for: item
              fragment: true
              in: =props.szenen.split(",")
              sourceType: array
            slots:
              default:
                - component: oh-button
                  config:
                    action: command
                    actionCommand: =loop.item
                    actionItem: ="Lichtszene_"+props.raum
                    size: 25
                    style:
                      --f7-button-text-color: black
                      font-size: 14px
                      height: auto
                      padding: 0
                      padding-left: 5px
                    text: =loop.item
          - component: oh-button
            config:
              action: command
              actionCommand: '=items["Bewegungssteuerung_"+props.raum].state == "ON" ? "OFF" : "ON"'
              actionItem: ="Bewegungssteuerung_"+props.raum
              icon-f7: '=items["Bewegungssteuerung_"+props.raum].state == "ON" ? "eye" : "eye_slash"'
              size: 25
              style:
                --f7-button-text-color: black
                font-size: 14px
                height: auto
                padding: 0
                padding-left: 5px
              visible: =!['Kinderzimmer','Schlafzimmer','Westzimmer','Wohnzimmer'].includes(props.raum)

How can I read the available options for a control item and save them in another item as a comma-separated list?

You don’t have to store the values in an Item, they are available if you use sourceType: itemCommandOptions in the oh-repeater.

          - component: oh-repeater
            config:
              for: item
              fragment: true
              itemOptions: =props.item
              sourceType: itemCommandOptions
            slots:
              default:
                - component: oh-button
                  config:
                    action: command
                    actionCommand: =loop.item.command
                    actionItem: ="Lichtszene_"+props.raum
                    size: 25
                    style:
                      --f7-button-text-color: black
                      font-size: 14px
                      height: auto
                      padding: 0
                      padding-left: 5px
                    text: =loop.item.label
1 Like

Thank you so much. That was the solution! It worked! Quick reply Thanks a lot!