Different list item types in oh-list-card from group using oh-repeater

Dear Community,

I’m currently trying to create a dynamic list (oh-list-card). Basically I want to iterate over all items in a group (e.g. with oh-repeater), for each item identify the type of the item (e.g. switch, dimmer, etc.) and add a corresponding list item (e.g. oh-slider-item, oh-toogle-item, oh-colorpicker-item) to the dynamic list.

I seem to be not able to find a working solution. Is this possible by default or will I have to resort to tags or similar?

Thank you for your help,

To answer my own question and potentially help others who look for the same:

- component: oh-list-card
    title: Ambientebeleuchtung
      - component: oh-repeater
          for: item
          sourceType: itemsInGroup
          groupItem: G_F0_WB_AmbienteLampen
          filter: '(loop.item.type=="Switch") ? true : false'
            - component: oh-toggle-item
                icon: ='oh:' + loop.item.category
                title: =loop.item.label
                item: =loop.item.name

So you can basically filter for the respective loop.item.type which corresponds to the actual type of the item. This could be e.g. Switch, Dimmer, Color, etc.

1 Like