Sitemap: block with different label name via visibility

Is it possible to create a Text block in a sitemap that will have a different label name based on the visibility feature?

Take this for an example, if my light timer is reported with a “0” it displays “[Lights OFF]”, if my light timer is >0 it displays how long till the lights go off: “[7 min]” like this:

Is this achievable with something like the code below or will have have to make a virutal item that is updated dependent on G_Timer_Lighting_OFF_Counter status which will display the value i want?

		Text label="Garage [Lights OFF]" icon="garage_detached" item=G_Timer_Lighting_OFF_Counter visibility=[G_Timer_Lighting_OFF_Counter==0] {
		Text label="Garage [%d min]" icon="garage_detached" item=G_Timer_Lighting_OFF_Counter visibility=[G_Timer_Lighting_OFF_Counter>0] {
			Switch item=G_Timer_Lighting_OFF_Counter label="Lighting" mappings=[7="Turn ON"] visibility=[G_Timer_Lighting_OFF_Counter==0]
			Switch item=G_Timer_Lighting_OFF_Counter label="Lighting" mappings=[0="Turn OFF"] visibility=[G_Timer_Lighting_OFF_Counter>0]			

You are on the right track. If you want to see a different element in your sitemap depending on the state of an Item, you’ll need to create a separate element and set the visibility to the one element you want to see based on the state of the Item.

I used to do this with my garage door opener when I used to use sitemaps. I’d have one element with a button lableed “Close” when the door was OPEN and another labeled “Open” when the garage was closed.

The element commanded the opener Item but visibility was determined by the sensor Item.

In MainUI it’s easier by using expressions.

Thanks! Thats what i thought, i havent ventured into the MainUI as i been happy working with my sitemap from the OH1.8 days till now :slight_smile:

Maybe this will be the start of modernizing myself. Thanks for your quick reply.

What convinced me to switch was the ability to create a widget like this:

where I have both the open/closed state of the door but also the locked/unlocked state of the deadbolt captured in one streamlined and reusable widget. That and the fact that most of the UI I need builds itself out of the semantic model.