Search location by property of equipment

Hello everyone,
i like to create a custom widget which creates a list with all OpenStates from the windows of a room.
Some rooms have more than one window.
My model structure looks like this:


The items marked in red are the “OpenStates” of the bedroom. (This room has 2 windows).

Now to my question:
How can i search for the items which are tagged with “OpenState” and “Opening” if I have the parent room as an parameter item?

I played arround with oh:repeater without success:

uid: windowCard
tags: []
props:
  parameters:
    - label: Title
      name: title
      required: false
    - context: item
      description: Item with all window states of this room
      label: Room
      name: location
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Nov 21, 2023, 9:45:33 PM
component: f7-card
config:
  style:
    border-radius: var(--f7-card-expandable-border-radius)
slots:
  default:
    - component: oh-list
      slots:
        default:
          - component: oh-repeater
            config:
              for: item
              fragment: true
              sourceType: itemsInGroup
              groupItem: =props.location
            slots:
              default:
                - component: oh-list-item
                  config:
                    title: =loop.item.label
                    item: =loop.item.name
                    icon: window
                    iconUseState: true

You are correct that the oh-repeater is the key to this question, however, the trick is that you are going to need more than one repeater because you need to loop through two layers of item nesting: location group → equipment group → OpenState points.

So, you’re first repeater will return all the equipment group items in the location and pass each one of those as the group item of a second repeater. Then you can use the repeater’s filter property in the second repeater to only return those points that have the tag "OpenState".

- component: oh-repeater
  config:
    for: equip
    sourceType: itemsInGroup
    groupItem: =props.location
    fragment: true
  slots:
    default:
      - component: oh-repeater
        config:
          for: point
          sourceType: itemsInGroup
          groupItem: =loop.equip.name
          fragment: true
          filter: loop.point.tags.includes('OpenState')
        slots:
          default:
            - component: oh-list-item
              config:
                title: =loop.point.label
                item: =loop.point.name
                icon: window
                iconUseState: true
1 Like