Use string in Switch item

Hello Community!
A simple question here: is it possible to show the content of a string together with the label of a Switch item in the sitemap?
I try to explain it with a line of code: if I put
Switch item = MySwitch label = "Fixed Label [%s]" <myIcon>
then the label of the switch will be “Fixed Label” and there will be a ON or OFF besides the toggle, since [%s] is the state of the item, which can only be ON or OFF.
Is it possible to use the state of another string in order to display something different than on or off?

Yes it is possible to to display something different. Yo should look into to the documentation about MAP transformation. With this you could map ON/Off to any string you like.

Syntax is:

SwitchRB_GF_LR_StoveLight_State "RB_GF_LR: Stove light power state MAP(]" <light_table_lamp>

where is a file in the tranform folder

Thank you Thomas!
Would your trick work if I wanted to display a timer (so, a variable string) together with the switch label?

You may need to pass the variable to a proxy item using a rule then post the proxy item on sitemap.

No that will not work. Displaying a remaining timer value is a chapter on its own.

1 Like

That sounds interesting! Do you have experience in this sense?

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.