OH3: Default List Item Widget Metadata not working


I’m running the release version of OH3 on/with openhabian. I’ve stumbled upon a problem with dynamic visibility.

Item 1: Doorlock. ON = Unlocked, OFF = Locked
Item 2: Opening function of said lock -> ON => Open door, goes to off after a few secs

I only want to show Item 2 on the different automatically generated pages when Item 1 is ON (Unlocked). Otherwise it should be hidden.

Code of Default List Item Widget Metadata:

value: oh-list-item
  actionCommand: ON
  listButtonColor: red
  visible: '=(items.HMTS_Eingang_Status.state == "ON") ? "true" : "false"'
  actionItem: HMTS_Eingang_Open
  icon: oh:lock
  action: command
  iconUseState: ""
  title: Haustür öffnen
  listButton: true

It does not work. Visibility is unchanged in for example the auto generated locations tab. Reloading does not change that. The same rule in developer sidebar is working and updating accordingly.

Also: I’m using this as a ‘listButton’. The color is not applied. No idea why. Any help appreciated.


Have you tried without the quotation marks for true and false? That’s the only difference I can see right now compared with my working code

That was the problem. Thanks for pointing out!

Still not sure why the color is not working.

For future reference, there is an expression checker in the developer sidebar that you can use to experiment and test such expressions. I don’t know if would have necessarily helped here but it’s a useful tool.

But because the expression needs to return true or false, you can simplify the expression to

=items.HMTS_Eingang_Status.state == "ON"
1 Like