OH3 metadata visibility

Hi, I have a fan control (convector) over z-wave and have mode item (off/cooling/heating) then another item to control the fan power.
I want to display the fan power widget in the locations tab only when the fan state is ON. I tried setting the visibility in “default list item widget” to zwavethingname_thermostatmode != “Off”, but that doesn’t work.

And the zwavethingname_thermostatmode literally has the values Off/Heating/Cooling/Fan_only.

I can’t find how to do that in OH 3

First it needs to be an expression so it should start with =.

Second to access an Item’s state in an expression you need to use items["NameOfItem"].state.

So, does it work if you apply that?

=items["zwavethingname_thermostatmode"].state != "Off"
1 Like

I’m struggling with the visibility expression here as well.
I have power metering wall plugs but only want to see them in the location card when they are actually ON.
So first I tried

=items["eg_wz_tisch2"].state != "Off"

where eg_wz_tisch2 is the item of the actual switch to no avail.

Then reading Building Pages - Components & Widgets | openHAB where the doc says to use the syntax as an example:

=items.TV_Powered.state === 'ON' && items.TV_Input.state === 'HDMI1'

so also tried

=items.eg_wz_tisch2.state != "OFF"

which also did not work.

So which expression is correct (or should both work) and what could be the reason why it does not work for me either way?

Wait. The second try contained a typo.
Now I’ve got:

=items.eg_wz_tisch2.state != "OFF"

which finally works as expected but contradicts the solution mentioned in this post?