Hide item on page based on value

Hello,

I am using many battery powered Homematic IP devices in my house. All of them have a channel “0#LOW_BAT (Switch)” which is ON if the battery is low and OFF otherwise. I like that openhab pages indicates automatically if the battery of one device in the room is low. However, I am only interested if a battery is “low”. Otherwise I do not want to see the switch. Actually, the UI is a becoming quite overwhelmed with battery switches (see attached screenshot). Is there a way to display/hide items in the UI based on the value?

Thanks for your help!

With best regards,
Daniel

You can define visibility (and many other options) of the Item in those UI lists, if you add Default List Item Widget metadata to the item. There you can use expression to evaluate state of the switch item.

The item is then only displayed when the low battery switch is ON.

Thanks a lot! Your hint was exactly what I was looking for. Now the battery items are hidden but the (empty) groups are leftover. I tried to use the same visibility option for the group referring to the battery switch item but they are not automatically hidden. Do you have any hint how I can also hide the empty groups (see screenshot attached).
Best regards,
Daniel