Struggling trying to get this to work and it’s supposed to be pretty simple. Trying to populate a dropdown box in a sitemap from a map file.
created the map file called: Greenhouse_PowderyMildew_Location.map
0=Unselected
1.1=1.1
1.2=1.2
1.3=1.3
2.1=2.1
2.2=2.2
2.3=2.3
3.1=3.1
3.2=3.2
3.3=3.3
4.1=4.1
4.2=4.2
4.3=4.3
5.1=5.1
5.2=5.2
5.3=5.3
item
String Greenhouse_PowderyMildew_PlantLocation "Plant Location" {mapping="Greenhouse_PowderyMildew_Location.map"}
sitemap
Selection item=Greenhouse_PowderyMildew_PlantLocation label="Plant Location"
doesn’t throw an error. just doesn’t pull anything up in the sitemap.
This might be part of the problem:
Tried to set invalid state 1.0 (DecimalType) on item Greenhouse_PowderyMildew_PlantLocation of type StringItem, ignoring it
That’s not the way it works.
There are two different mappings in openHAB. The first mapping is about transform a value to another (which is completely independent). This is used for display purpose most of the time. Pairs of values are defined in a *.map file and you can use it with the mapping transformation service:
label="My label [MAP(my.map):%s]"
The second mapping is to render lists or multiple buttons instead of one when using a sitemap. THis mapping does not use a *.map file at all.
Instead, you’ll have to write it down in the sitemap:
Selection item=Greenhouse_PowderyMildew_PlantLocation label="Plant Location" mappings=[0="Unselected",1.1="1.1",1.2="1.2",1.3="1.3",2.1="2.1",2.2="2.2",2.3="2.3",3.1="3.1",3.2="3.2",3.3="3.3",4.1="4.1",4.2="4.2",4.3="4.3",5.1="5.1",5.2="5.2",5.3="5.3" ]
got, thanks! i was trying to avoid the long entry in the sitemap and just deal with a file. i’ll make the changes and hopefully off and running.
thanks @Udo_Hartmann !