List items for displaying all items with state UNDEF?

Hi there,

Quick question - I want monitor all my sensors, regardless of battery state.
Therefore, I use an update state expiration timer that, that sets the item’s state to UNDEF after two hours.
I’m doing this for example on the temperature item of an environmental sensor.

I now want to create a page that shows all the items (or better, their underlying Things) in a list item.
However, I’m not sure how you would create this kind of dynamic lists. Do you create a dynamic item (string), iterate over all items in state UNDEF, extract the Thing label, push it into this string label and display it?
Or is there a way to define scripts/filters on lists widgets?

Can anyone push me in the right direction?

That’s not possible. Widgets, and most everything else works with Items, not Things.

This. Look at the oh-repeater widget. You can iterate and filter over a Group’s members it all Items with a given tag, filter then and build a list of list item widgets to show.

There’s are several tutorials and examples including the Battery Status widget in the Marketplace.

1 Like

Thank you very much!

One quick question, I’m not sure where I can find reference for the expressions syntax used in for example oh-repeater.

I noticed that I have to use:

filter: items[loop.item.name].state == "UNDEF"

Although I thought UNDEF is a constant.
I also saw you using displayState === undefined, without quotes, why is that?

Could you kindly point me to the correct docs for this?

Thank you very much!

It’s a subset of standard JavaScript. Building Pages - Components & Widgets | openHAB

Further information is on that page and the rest of the UI docs. There is more about filter itself in the oh-repeater reference page in the docs and a number of tourism’s on the forum.