Problem with visibility

I am using a Window Shutter contact which has two channels: “contact_state” and “battery_low”. the “battery_low” is a read-only switch. My aim is to show up an item in the UI ONLY for all items with the battery_low ON switch which i cant seem to realize asi dont know how to make a Channel the prerequisite for a visibility.
My code in the sitemap was:

Text item=Fensterkontakt_DG_ZimmerR_Bat icon=lowbattery visibility=[battery_low==ON]

grateful for any hint.

Which UI are you using

basic ui

From what i understand, you want the item to only show on a specific state. If you don’t know that state you can set visibility only to known state. You can however, use HABPanel and create a specific custom widget that will display items in a group with specific state.

Works like a charm for me. You just can’t compare two items to each other, one part of the condition has to be static, the other one has to be an item.

Some examples from my sitemap (Thermostat mode and Squeezebox title):

Text item=AZWT_MODE label="AZWT [MAP(HM-CC-RT-DN.map):%s]" visibility=[AZWT_MODE!="AUTO-MODE"]

Text item=SBB1_Title icon="info" visibility=[SBB1_Power==ON]

I still am unsure how that can help
me with my issue as the parameter for beeing visible has to be the ON state
of a channel, in this case a switch type…
Can’t find my error.

“SBB1_Power” is a Switch similiar to your “battery_low” Switch.

How is your battery_low Switch item defined?

Switch Fensterkontakt_DG_ZimmerR_Bat "Dachfenster Zimmer rechts" (gBatteries,gZR) {channel="max:shuttercontact:MKF0061363:NEQ0165152:battery_low"}

checking the log gives an error:

2017-12-31 09:10:24.008 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve visibility item battery_low for widget org.eclipse.smarthome.model.sitemap.Text

You have to use the switch in your definition, not the channel:

Text item=Fensterkontakt_DG_ZimmerR_Bat icon=lowbattery visibility=[Fensterkontakt_DG_ZimmerR_Bat==ON]

thats the magic… working now, thanks for the help.

ran into another problem: with the same example as above with the items showing in a group frame WITHOUT visibility parameter i get different display results, although all are defined the same way… for 12 of my items it shows the label and a switch (although its readable only) and for one item (the first) it shows “OFF” ADDITIONALLY (while the others have no text).
So what i would like is to hide the text “OFF” for the one item and the switch for ALL items, so they battery_low state is shown through the icon only…

The label definition defines what is shown. The state is displayed by the definition in brackets: “[ ]”.

yes, but as i got no definition in brackets, there shouldnt be a text and it doesnt explain why one got a text and 12 dont… and it doesnt solve my problem with the switch which shouldnt be seen…

The problem is, nobody knows your exact definition except yourself. I suggest, you post your definition.

mh, i already did? here again the full list:

part of the Sitemap

Group item=gBatteries label="Batteriestatus" icon=battery

part of the items

Switch Fensterkontakt_DG_Bad_Bat "Bad Dachfenster" <lowbattery> (gBatteries,gDG_Bad) {channel="max:shuttercontact:MKF0061363:NEQ0165338:battery_low"}
Switch Fensterkontakt_DG_ZimmerR_Bat "Arbeitszimmer rechts Dachfenster" <lowbattery> (gBatteries,gZR) {channel="max:shuttercontact:MKF0061363:NEQ0165152:battery_low"}
Switch Fensterkontakt_DG_ZimmerL_Bat "Arbeitszimmer links Dachfenster" <lowbattery> (gBatteries,gZL) {channel="max:shuttercontact:MKF0061363:NEQ0165180:battery_low"}
Switch Fensterkontakt_OG_KinderzimmerRR_Bat "Kinderzimmer rechts Balkontür" <lowbattery> (gBatteries,gOG_KZR) {channel="max:shuttercontact:MKF0061363:NEQ0846617:battery_low"}
Switch Fensterkontakt_OG_KinderzimmerRL_Bat "Kinderzimmer rechts Fenster" <lowbattery> (gBatteries,gOG_KZR) {channel="max:shuttercontact:MKF0061363:NEQ0847308:battery_low"}
Switch Fensterkontakt_OG_KinderzimmerLR_Bat "Kinderzimmer links Balkontür" <lowbattery> (gBatteries,gOG_KZL) {channel="max:shuttercontact:MKF0061363:NEQ0847298:battery_low"}
Switch Fensterkontakt_OG_KinderzimmerLL_Bat "Kinderzimmer links Fenster" <lowbattery> (gBatteries,gOG_KZL) {channel="max:shuttercontact:MKF0061363:NEQ0847299:battery_low"}
Switch Fensterkontakt_OG_Bad_Bat "Bad Fenster" <lowbattery> (gBatteries,gOG_Bad) {channel="max:shuttercontact:MKF0061363:JRE0003037:battery_low"}
Switch Fensterkontakt_OG_SchlafzimmerR_Bat "Schlafzimmer rechtes Fenster" <lowbattery> (gBatteries,gOG_SZ) {channel="max:shuttercontact:MKF0061363:JRE0005615:battery_low"}
Switch Fensterkontakt_OG_SchlafzimmerL_Bat "Schlafzimmer linkes Fenster" <lowbattery> (gBatteries,gOG_SZ) {channel="max:shuttercontact:MKF0061363:JRE0005401:battery_low"}
Switch Fensterkontakt_KuecheL_Bat "Küche linkes Fenster" <lowbattery> (gBatteries,gEG) {channel="max:shuttercontact:MKF0061363:JRE0005401:battery_low"}
Switch Fensterkontakt_KuecheR_Bat "Küche rechtes Fenster" <lowbattery> (gBatteries,gEG) {channel="max:shuttercontact:MKF0061363:JRE0005401:battery_low"}
Switch Fensterkontakt_Wohnzimmer_Bat "Wohnzimmer Terrassentür" <lowbattery> (gBatteries,gEG) {channel="max:shuttercontact:MKF0061363:JRE0005401:battery_low"}

The first item shows the text “off”, the rest doesnt.

for some reason, although i didnt change anything (but switch a battery) the problem solved itsself…