Item Visibility

Hi,

I cannot seem to get visibility to work. I have the following in my items files.

/* Network Health */
Group:Switch:OR(ON, OFF) h_P_gPresence “Presence”
Switch h_P_Chris “Chris” <boy_1> (h_P_gPresence) {nh=“ChrisOPO”}
String h_P_Chris_Away “Away” (h_P_gPresence) visibility=[h_P_Chris!=ON]
Switch h_P_Vikki “Vikki” <girl_2> (h_P_gPresence) {nh=“android-9c82c5769a1af307”}
String h_P_Vikki_Away “Away” (h_P_gPresence) visibility=[h_P_Vikki!=ON]

Basically the Sring should only show if the phone is disconnected. It just says Away for now, but I will be making this more useful once i get past this part.

Any help and suggestions welcome.

Also openhab designer states an error, but i’m not sure why as i’ve compared to other examples and it looks ok to me.

Many Thanks,
Chris

Try this… visibility=[h_P_Chris==OFF]

Thanks,

Just tried it but the String is always visible still. I have one phone on the network and other is away, so one should show and the other not.

Chris

The visibility attribute should be on in your sitemap, not the Items file, unless this is something that is new in OH 2 that I’m unaware of.

Thank you Rich,

I was just displaying the group in my sitemap without defining what was in it, just letting it pull all items in the group from the items files.

I now have this in my sitemap.

Frame label="Presence" {
	Group item=h_P_gPresence label="Population [%d]" {
		Switch item=h_P_Chris
		Text item=h_P_Chris_Away visibility=[h_P_Chris==OFF]
		Switch item=h_P_Vikki
		Text item=h_P_Vikki_Away visibility=[h_P_Vikki==OFF]
	}
}

and this in my items file.

Group:Switch:OR(ON, OFF) h_P_gPresence “Presence”
Switch h_P_Chris “Chris” <boy_1> (h_P_gPresence) {nh=“ChrisOPO”}
String h_P_Chris_Away “Away” (h_P_gPresence)
Switch h_P_Vikki “Vikki” <girl_2> (h_P_gPresence) {nh=“android-9c82c5769a1af307”}
String h_P_Vikki_Away “Away” (h_P_gPresence)

Thats one problem solved.

Many Thanks,
Chris