Getting the mapped string value of a number item

I have a number item in my sitemap:

Selection item=Scene_LivingRoom label="Scene Selector" mappings=[1="OFF", 2="ON", 3="DINNER", 4="READING",5="FIREPLACE", 6="BAR", 7="PARTY", 8="TV",9="COOKING", 10="WALL", 11="KITCHEN", 12="LOUNGE"]

In my rule when the scene change I would like to grab the string mapping(like DINNER) instead of the integer(3) is this possible?

I think that’s not possible when you only have that mappings in the sitemap.
You should create a Transformation file with the same mappings, than you can access them inside a rule like this:

var String textstring = transform(“MAP”, “”,Intergervalue.toString)

with the


But maybe there is a better approach i don’t know?

1 Like

Make sense since the call might not just come from the sitemap! I will move it to a mapping file. That will work for me, thanks

Maybe its late, but shouldnt this work in the sitemap?

Switch item=Scene_MasterBedRoom label="Scenes [MAP(]"

with this map.file:


as far as i know, the label text can’t be changed dynamically… That’s a different approach than you posted before!

A workarround is to use multiple items with different visibility to “change sitemap items dynamically”

Something like that:

Image url="http://localhost:8080/rrdchart.png?items=presence,group_presence&period=D&w=800" refresh=60000 visibility=[period == 0]
Image url="http://localhost:8080/rrdchart.png?items=presence,group_presence&period=W&w=800" refresh=60000 visibility=[period == 1]
Image url="http://localhost:8080/rrdchart.png?items=presence,group_presence&period=M&w=800" refresh=60000 visibility=[period == 2]
Image url="http://localhost:8080/rrdchart.png?items=presence,group_presence&period=Y&w=800" refresh=60000 visibility=[period == 3]

I used to have mapping like this:

Switch item=Scene_MasterBedRoom label="Scenes" mappings=[1="OFF", 2="ON", 3="NIGHT", 4="READING"]

but I am reading up on the documentation, but I can not find a clear example how to do it:
transformation service

last one said : Usage of Transformations in the label parameter of Sitemap elements works the same way, and it links you here:
Text item=Temperature label="Livingroom [%.1f °C]" icon="temperature"

I assume it should be
Switch item=Scene_MasterBedRoom label="Scenes " mappings=[] where the mapping file needs to be in any subfolder in the transformation folder catatlog…

I find it on this topic hard to read the documentation, maybe we could rewrite it @Kai? I could help on it, just need some input.

Also the rest of the sitemap documentation uses full examples while mappings not:
mappings=[value_1="description_1", value_2="description_2", ...] vs
Video [item=<itemname>] [icon="<iconname>"] url="<url of video to embed>" [encoding="<video encoding>"]

We should rewite it to :

Switch item=dummyItem label="DummyLabel" mappings=[value_1="description_1", value_2="description_2", ...]

to keep it consistent through out the documentation