A couple of simple oh-repeater examples

Thanks Justin. That is actually really nice.

I could not get the location. Is that because the item related to equipment instead of directly within a location?

Yes. The semantic tags do not propagate down the hierarchy so hasLocation only works for equipment not points.

In some cases you may want to add some points to the location group directly, in addition to the equipment. For instance adding a temperature measurement to a room location, because it represents the temperature in the room.

Am I going mad? I can’t seem to search more than one itemTag at a time.

I type itemTags: Smartphone and all Smartphone tagged items are found. But the moment I add a second term I get 0 results itemTags: Smartphone,Smartwatch

All of the examples above that use more than one term just seperate with a comma, but this just isn’t working for me

The array in itemTags is treated as AND. You cannot search for Smartphone OR Smartwatch, but you can search for Switch AND Light or Door AND Status.

Ahhh…
secrets.

Wonder why this simple info isn’t in the docs?

Is there a way to do OR?

This isn’t really a choice of the UI design, it comes directly from the API; that’s how the API call to fetch items works. That said, this question does come up once in a blue moon and may be worth adding to the docs.

Yes, but…

You can get the repeater to return a complete list of all the items and then use the repeater filter property to get only tag A OR tag B. The ‘but’ here is that that’s going to be somewhat process intensive and if you have to do it more than a few times on a UI page, you’re definitely going to see a slow down.

The better solution here is just to add another custom tag to these items, PersonalDevice or some such and then use that in the repeater. Yeah, it’s one small extra step, but it results in more direct control of which items your repeater is delivering and, although I don’t know your system, I’m going to guess that these items don’t change or get added and removed often enough for this to be a particular hardship from an administrative standpoint.

2 Likes

Thanks. You always give very good answers.

No idea if I can post it here, but for some reason my icons are not dynamic anymore in my oh-repeater

Code:

- component: oh-repeater
            config:
              for: item
              fragement: true
              groupItem: Blinds
              sourceType: itemsInGroup
            slots:
              default:
                - component: oh-rollershutter-item
                  config:
                    icon: oh:rollershutter
                    item: =loop.item.name
                    title: =loop.item.label

And this as result:

Which looks good enough except that my icon is not showing the correct state, for example if I check it in the Overview>Location it looks like this:
image

here it is clearly closed, tried finding on the forums why it does this but can’t find what im doing wrong.

When using an OH icon there is a second parameter to indicate if the icon is dynamic or not (in the UI it’s called “Icon depends on state” but I’m not sure what the actual name of the field is. From a quick scan of the reference docs it looks like it might just be state.

For OH icons the state parameter lets you manually set a state which the icon will respond to (which can of course just be set to the dynamic state of an item).

For the family of list item components, such as the oh-rollershutter-item the parameter to use is iconUseState which you just set to true if you want the icon to respond to the state of the item that the component is bound to.

2 Likes